Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / December 2007

Tip: Looking for answers? Try searching our database.

How to serialize Excel Workbook into a memory stream

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
leviw - 18 Dec 2007 23:08 GMT
Is there a way to save a dynamically created Excel workbook to a
Memory stream?  There are no overloads in the Save method to save to a
stream.  I want to create a web service that will dynamically generate
an Excel file, but do not want to use a temporary file for each call.
I cannot get the stream as it says the interface is not serializable.
Is there any way to do this?  Is there a way to find out if the COM
object supports IPersistFile or anything?  Thanks in advance.

Levi
leviw - 20 Dec 2007 21:51 GMT
> Is there a way to save a dynamically created Excel workbook to a
> Memory stream?  There are no overloads in the Save method to save to a
[quoted text clipped - 5 lines]
>
> Levi

Well, I haven't gotten much further.  I did see that it supports the
IPersistStorage interface (the workbook does).  I am using C# for
this, by the way.  I _should_ be able to instantiate an IStorage
interface using the IPersistStorage::InitNew method, and from there
call IPersistStorage::Save, and then use the IStorage interface to
open up a stream that I can get into a byte array, right?  Has anyone
had any luck with this, or has anyone worked with COM interop like
this before?  I've defined these interfaces in C#, but when I try to
call IPersist.InitNew(pStg), pStg is still set to it's initial value
of NULL.  Any help/insight would be greatly appreciated.
leviw - 20 Dec 2007 22:07 GMT
> > Is there a way to save a dynamically created Excel workbook to a
> > Memory stream?  There are no overloads in the Save method to save to a
[quoted text clipped - 16 lines]
> call IPersist.InitNew(pStg), pStg is still set to it's initial value
> of NULL.  Any help/insight would be greatly appreciated.

Correct, when I call IPersistStorage.InitNew...I've been able to cast
the workbook as an IPersistStorage.  I just can't get any further than
that.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.