Open GoogleCodeExporter opened 8 years ago
I have the same issue. Saving to a memory stream does not appear to work
correctly, and results in corrupted files. Saving exactly the same document to
disk results in a correct file.
Inspecting the bytes, it appears that a header is not being added to the stream
version...
Original comment by snick...@gmail.com
on 26 Jan 2012 at 11:07
Is this fixed? Is there a work around that doesn't involve saving the .xls
file to the server?
thanks!
Original comment by scif...@gmail.com
on 1 Feb 2013 at 1:50
I have been troubleshooting this today and found that the stream created in
memory (i.e., the MemoryStream) just needs to be "rewound" since it returns
partially advanced. You can inspect the Position property of your memory stream
and see it is at 512 instead of zero like it should be. So in my case, one line
of code allowed me to work around this:
MemoryStream memStream = new MemoryStream();
book.Save(memStream);
// Per ExcelLibrary issue #62, must rewind the MemoryStream position back to
zero!
memStream.Position = 0;
// Yay! File generated by memStream is no longer corrupt.
Best of luck!
Original comment by funka...@gmail.com
on 28 Feb 2013 at 7:53
Original issue reported on code.google.com by
milorad....@gmail.com
on 20 Jul 2010 at 3:47