FYI :
this code works in order to read a file into a XSSFWorkbook:
When fileStream.Read( ) reads, the stream keeps positioned at end, so when unzipper needs to read it gets "EOF".
Thanks for your help.
Luis.
this code works in order to read a file into a XSSFWorkbook:
private IWorkbook InitializeAddingWorkbook(HttpPostedFile postedFile)
{
Stream fileStream = postedFile.InputStream;
byte[] fileContents = new byte[postedFile.ContentLength];
fileStream.Read(fileContents, 0, postedFile.ContentLength);
fileStream.Position = 0; // <---- remember to rewind the stream
return new XSSFWorkbook(fileStream);
}
Just remember that XSSFWorkbook needs a zip library to decode zipped xml, and the stream passed to the unzipper needs to be at 0 position.When fileStream.Read( ) reads, the stream keeps positioned at end, so when unzipper needs to read it gets "EOF".
Thanks for your help.
Luis.