Free Support Forum - aspose.com

SaveToStream not working?

Hi

I have created a workbook within my application. I can successfully save the Workbook to the filesystem. however when I save this same workbook to a MemoryStream so that I can add it to a ZIP file it creates a blank workbook.

Here is the sample code:

workbook.Save("MyXLS.XLS")

Dim myStream As System.IO.MemoryStream = workbook.SaveToStream()

Dim fileData() As Byte = myStream.ToArray()

myZIPFile = ReturnZIPFile(filedata)

Please help as this is driving me crazy!

Many Thanks.

Alan Gardner.

Hi Alan,

After calling Save method, Workbook object is reset. So to save your file to a zip file, please remove first line of code.