Unreadable content for Excel 2007

Hello,

When we use Aspose to generate Excel file, It works very well on Excel 2003. But we met some error when we generate Excel2007 file. The following is our sourcecode on Excel2007:

//Save the Excel file.

MemoryStream ms = new MemoryStream();

//wb.Save(ms, FileFormatType.Excel2003);

wb.Save(ms, FileFormatType.Excel2007Xlsx);

byte[] content = ms.ToArray();

Response.ClearContent();

Response.ClearHeaders();

Response.ContentEncoding = Encoding.UTF8;

Response.Charset = "utf-8";

//Response.ContentType = "application/vnd.ms-excel";

Response.ContentType = "application/xlsx";

//Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".xls");

Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".xlsx");

Response.BinaryWrite(content);

Response.End();

Our Aspose.cell's version is 4.7.1 and here is the detail error information condition:

when we open the excel the following error popup.[Please check the attachment 1.JPG]

And when I click yes, I got another popup like this:.[Please check the attachment 2.JPG]

And here is the log file of the error:.[Please check the attachment 3.JPG]

After I click Close button, the file seems display well, that means all the content appeared. But it’s not good for our clients to always get the error box every time they open the excel. Could you please help me to solve this condition?

Many thanks!

Brian

Hi Brian,

Thank you for considering Aspose.

Well, I checked you code and it works fine. Please share your template file(if any), your generated file and your complete code to reproduce the issue. We will check it soon.

Thank You & Best Regards,

Hello,

Thanks for your reply! The attachment Code.txt is the complete code and the file Indicators-20090827-1430817.xlsx is the Excel file we generate, thanks!

Brian

Hi,

Thanks for providing us the template XLSX file and sample code.

We have analyzed the .xlsx file and found that some extra data was added to it. Actually this extra data might force MS Excel display warning message. The extra data is a string, i.e…,:

“”

There is a possibility that it might be the Response object that has added the extra text into the file streams.

Please try to save the file directly to disk (not through Response or streams) and check again whether you still find this issue or not. And, please let us know about it.

Thank you

Hello,

We remove the extra string and it is ok now, many thanks!

Brian