Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
I have a program which has an xsl file sitting in a blob of memory.
I want to use the Excel object model to load up the blob, and to read the rows/columns etc. Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
Peter,
I am unfamiliar with the programming term "blob". However, if your data is stored in an array then data in an array can be transferred directly to an Excel worksheet... '------------------------------- Sub Test() Dim strArray() As String Dim i As Long Dim j As Long ReDim strArray(1 To 10, 1 To 10) For i = 1 To 10 For j = 1 To 10 strArray(i, j) = i * j Next Next Worksheets(1).Range("A1:J10").Value = strArray End Sub '------------------------------ Regards, Jim Cone San Francisco, USA "Peter Hurford" wrote in message oups.com... I have a program which has an xsl file sitting in a blob of memory. I want to use the Excel object model to load up the blob, and to read the rows/columns etc. Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
Sorry, looks like I didn't ask the question very well. blob = binary
large object. Imagine you open a spreadsheet, just running Excel interactively. The file you load up sits on the disk, right? And you just issue a "File | Open" command, select the filename, and you're away... And of course there's nothing to stop you doing exactly the same thing programmatically with vba. Well, in my case I have a program that wants to load up a spreadsheet. Only thing is, the spreadsheet isn't a file on the disk, it is sitting in a chunk of the program's memory. Now, as far as my program is concerned it is just a bunch of binary data, won't make any sense to it (just the same as if you open an xls file in notepad). So, the thing to do is to load this chunk of memory into Excel - then I can use the excel object model to peek at the row/column values. Hence my earlier question. I want to be able to load a spreadsheet from memory rather than from a physical file. Any takers? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
"Peter Hurford" wrote in message oups.com... I have a program which has an xsl file sitting in a blob of memory. I want to use the Excel object model to load up the blob, and to read the rows/columns etc. Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete If you want to everything to be in memory, you should use a RAM Disk. It will appear as a hdd but it will use RAM http://www.winsoft.sk/ramdisk.htm /Fredrik |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
I have a program which has an xsl file sitting in a blob of memory.
I want to use the Excel object model to load up the blob, and to read the rows/columns etc. I don't know for sure, but I don't think that the Excel Object Model offers any functions for handling memory management. Two options I can see: -1- Use vba to call win32 memory management api (shared memory and stuffs) to extract information from the blob. -2- If you are using Excel2003 + Vitual Studio .NET, you can use "Visual Studio Tools for MS Office" (VSTO); You can use c#/vb.net to deal with the xls file in memory and, with help of VSTO, transform and save it in excel format. HTH --- arunkhemlai Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
Hi Peter,
Did you ever find a solution to this problem? I'm wanting to do the same thing (basically load a file from a stream) but can't find any references to doing this. Not sure if you ran into this as well, but I am trying to open files from a web server, which works fine, but if I try to open 1 file, it doesn't work as the file names take on the name of the server, and you can't open 1 file with the same name. For e.g. you go File|open "http://myweb.com/somefile.aspx", assuming the aspx returns an output type (MIME type) of excel, this will open fine, will be read-only and will be called 'myweb'. If you then try to open "http://myweb.com/someotherfile.aspx", this fails because excel wants to name the file 'myweb' but can't as there's already a file there called that. How can we change the filename without having to save it to disk, and preferably in code. Any takers?!?! "Peter Hurford" wrote: I have a program which has an xsl file sitting in a blob of memory. I want to use the Excel object model to load up the blob, and to read the rows/columns etc. Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
I wonder why Outlook and exchange know to rename a open file with a (1)
after the name -- Book1 becomes Book1(1) when opened again-- but the method you are using won't. "stevefromoz" wrote in message ... Hi Peter, Did you ever find a solution to this problem? I'm wanting to do the same thing (basically load a file from a stream) but can't find any references to doing this. Not sure if you ran into this as well, but I am trying to open files from a web server, which works fine, but if I try to open 1 file, it doesn't work as the file names take on the name of the server, and you can't open 1 file with the same name. For e.g. you go File|open "http://myweb.com/somefile.aspx", assuming the aspx returns an output type (MIME type) of excel, this will open fine, will be read-only and will be called 'myweb'. If you then try to open "http://myweb.com/someotherfile.aspx", this fails because excel wants to name the file 'myweb' but can't as there's already a file there called that. How can we change the filename without having to save it to disk, and preferably in code. Any takers?!?! "Peter Hurford" wrote: I have a program which has an xsl file sitting in a blob of memory. I want to use the Excel object model to load up the blob, and to read the rows/columns etc. Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a spreadsheet from memory
I don't understand it either :-S
I'm just using Application.Workbooks.Open("url") s. "William Benson" wrote: I wonder why Outlook and exchange know to rename a open file with a (1) after the name -- Book1 becomes Book1(1) when opened again-- but the method you are using won't. "stevefromoz" wrote in message ... Hi Peter, Did you ever find a solution to this problem? I'm wanting to do the same thing (basically load a file from a stream) but can't find any references to doing this. Not sure if you ran into this as well, but I am trying to open files from a web server, which works fine, but if I try to open 1 file, it doesn't work as the file names take on the name of the server, and you can't open 1 file with the same name. For e.g. you go File|open "http://myweb.com/somefile.aspx", assuming the aspx returns an output type (MIME type) of excel, this will open fine, will be read-only and will be called 'myweb'. If you then try to open "http://myweb.com/someotherfile.aspx", this fails because excel wants to name the file 'myweb' but can't as there's already a file there called that. How can we change the filename without having to save it to disk, and preferably in code. Any takers?!?! "Peter Hurford" wrote: I have a program which has an xsl file sitting in a blob of memory. I want to use the Excel object model to load up the blob, and to read the rows/columns etc. Is there any way to do this *without* having to save my blob to a file on the hdd first? I would like to keep everything in memory if possible, since once the blob has been processed, it is discarded. TIA, Pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Not Enough Memory opening 2nd spreadsheet | Excel Discussion (Misc queries) | |||
Remove content when saving / loading spreadsheet | Excel Worksheet Functions | |||
Loading a linked spreadsheet, Microsoft Visual Basic, error while. | Excel Discussion (Misc queries) | |||
Memory expanding spreadsheet | Excel Programming | |||
Insufficient memory error using shared excel spreadsheet | Excel Programming |