Opening 2003 xls protected workbook caused an exception "End of stream reached" in .NET

We have an intermittent issue with Aspose.Cells. We are currently using version 4.7.0.3. We have users that upload Excel 2003 xls files and the system opens them to check for correct entry, data, etc.


Occassionally we get a user who can’t upload the xls and the error is “End of Stream” reached. If we open the file manually with Excel and do a Save As… and select the 97-2003 format, we can then upload the files with no problems. This does not occur with all the files uploaded, only occasionally.

When the field person tried to upload they get the error. They then send it in to our contact person who tries to upload and gets the same problem. The file was then emailed to me and I get the same problem, both on my local development machine and the devlopment web server.

I have attached two files to this post. The 2010 Budget.xls is the file that fails, and the 2010 budget resaved.xls is the same file, but I opened it in Excel 2007 as a 2003 document and “saved as” 2003 xls file. The file then opened just file.

The workbooks are password protected as well as the VBA code. I don’t have the passwords, but I don’t think that they are the problem, as the “re-save” in the format corrects it.

Thanks

Here is a partal stack trace and source code.


Error Message / Stack Trace
---------------------------

End of stream reached.:
at Aspose.Cells.RW.?.?(Byte[] ?)
at Aspose.Cells.RW.?.?(? ?)
at Aspose.Cells.RW.?.?(? ?)
at Aspose.Cells.RW.?.?(MemoryStream ?)
at Aspose.Cells.RW.?.?(? ?)
at Aspose.Cells.RW.?.?(Stream ?)
at Aspose.Cells.Workbook.Open(Stream stream, FileFormatType type)
at Aspose.Cells.Workbook.Open(Stream stream)
at DOMBudgets.extract.CERTTable…ctor(String filename, String filetype)
in CERTTable.cs:line 75



CERTTable.cs:line 75 w/context
-------------------------------
Line 55: FileStream fs = null;
.
Line 66: fs = new FileStream(filename,FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
.
Line 73: else if (filetype.ToLower().EndsWith(“xls”))
.
Line 75: excel.Open(fs);
Line 76: FileOpened = true;

Hi,

Thank you for considering Aspose.

After testing your template file, we think the template file was created in Excel 2000-2003 and re-saved in Excel 97. So, there are some very strange records. We will further look into this issue and get back to you.

Thank You & Best Regards,

We did know that a few of our users have Office 97, but, the documentation that we have found listed Excel 97-2003 as being BIFF8, so we didn’t consider that to be the problem.

Thanks for working on a fix for this, we have a period of time approaching where our application will be hit pretty hard and this being supported will eliminate quite a bit of hassle.

Thanks.

I decided to try a couple of things as your techs were looking into this.

I used the overloaded open method which includes the file type. I tried “Default”, “Excel97”, “ExcelXP”, “Excel2000”, and “Excel2003” all of which returned the “End of Stream Reached” error message on the problem files, but all of which open the “resaved” file without any issues.

Thank You.

Hi,

Please try the attached version, we have fixed your mentioned issue.

Thank you.

This took care of the problem, thanks for the quick response. Without giving away too much, can I ask what the “general” problem with the xls was?

Thanks.

Hi,

We will get back to you soon to provide you the main problem regarding your issue.

Thank you.

The issues you have found earlier (filed as 8115) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Amjad Sahi.