Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not Enough Memory opening 2nd spreadsheet Pete Harris Excel Discussion (Misc queries) 2 March 14th 08 04:03 PM
Remove content when saving / loading spreadsheet EZdoesIT Excel Worksheet Functions 4 November 13th 06 03:42 PM
Loading a linked spreadsheet, Microsoft Visual Basic, error while. Wacher Excel Discussion (Misc queries) 0 April 18th 05 03:15 PM
Memory expanding spreadsheet JohnUK Excel Programming 0 June 2nd 04 08:37 PM
Insufficient memory error using shared excel spreadsheet Eric Lustig Excel Programming 1 September 26th 03 06:34 PM


All times are GMT +1. The time now is 04:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"