Hi, I 'am using Aspose.Cells in dot.net application to export data to both formats Excel2003(.xls) and Excel2007(.xlsx), my export it goes fine with the format Excel2003,once i change to Excel2007 format i got this message when i try to open the document "Excel found unreadable content in 'doc1.xlsx'.Do you want to recover the contents of this workbook? if you trust the source of this workbook,click Yes."
once i click yes an other popup comes out saying : "Excel has been able to open the file by removing or repairing the unreadable contents ."
I just get my doc after in right format and data... I've been looking everywhere , Any ideas on what can be done to avoid this error message??
How do you export data to Excel 2007 .xlsx format, do you use some template file or get data from some data source to fill a new workbook. Could you create a sample test code with the template file (if you use) and post it here to reproduce the issue, we will check your issue soon. Moreover, kindly post your created excel .xlsx file (which displays such error messages).
Hi Amjad, Thanks for the reply.Well I am using some datasource to fill my workbook, here you 'll find the excel file created and Text File containing the full code of my Export function attached to this mail.
Ps : The same code works fine with Excel2003 Format
Hi, After reading the file and saving again, it’s like you accept that Excel repared the file so it don’t show the error message again. I tried to save the file directly to the disk, and it goes fine no warning comes out (You can find it attached to this mail)!!! but still need the export goes right with the stream. I attached a web Application test so you can try the export to differents formats and reproduce the error with Excel2007 Format . Thanks, i will appreciate any help could be given to the current problem
Hi, I am gonna send two classes from my project, witch include how i save the file to the stream and output it with Response and how i fill my workbook and save the stream to the Excel2007 format.
if this still not giving help, let me know and i 'll try to make other project showing how it works
i tried to call Response.Flush() after the saving but nothing seems changing, still got the same message.
We have found the problem in your codes. You should use MemoryStream.ToArray() to get the data of the MemoryStream not MemoryStream.GetBuffer().See following codes:
BTW, you can use Workbook.Save(string fileName, FileFormatType fileFormatType, SaveType saveType, HttpResponse response) method to write file data to repsponse