This project has moved and is read-only. For the latest updates, please go here.

Error opening XLSX Excel file

Nov 7, 2012 at 9:23 AM
Edited Nov 7, 2012 at 12:31 PM

Hello there, 

thank you for this great tool.

I am having issues opening this excel file, that opens correctly on the Excel 2010.

http://www37.zippyshare.com/v/7834578/file.html

Any Ideas why?

here it is the code. I receive Object reference not set to an instance of an object at last line.

 

            System.IO.FileInfo newFile = new System.IO.FileInfo(@"C:\Temp\grid.xlsx");

            ExcelPackage excelP = new ExcelPackage(newFile);

            ExcelWorksheet ws = excelP.Workbook.Worksheets[1];

 

thank you and regards

Nov 7, 2012 at 10:32 AM

hedzx,

Please download lastest version, works fine here with 3.1.2.

Regards,

Thiago

Nov 7, 2012 at 11:07 AM

it works!! 

thank you so much man, you made my day happier :)

Nov 7, 2012 at 12:57 PM

by the way I can edit and save the file, but I am having another issue.

after saving and open in excel 2010 the Excel is complaining about some unreadable content and asks if I want to recover.

http://www13.zippyshare.com/v/31858409/file.html

 

System.IO.FileInfo newFile = new System.IO.FileInfo(@"C:\Temp\grid.xlsx");
ExcelPackage excelP = new ExcelPackage(newFile);
ExcelWorksheet ws = excelP.Workbook.Worksheets[1];
excelP.Save();

<?xml version="1.0" encoding="UTF-8" standalone="true"?>-<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error051800_01.xml</logFileName><summary>Errors were detected in file 'C:\Temp\grid.xlsx'</summary>-<repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet0.xml part</repairedRecord></repairedRecords></recoveryLog>

 

any ideas?

regards.

Nov 8, 2012 at 12:31 PM
Edited Nov 8, 2012 at 12:32 PM

this is very strange... the xlsx excel files comes from an external .net component grid view that exports to this format.

the Excel opens very well the unchanged version.

if I save with epplus this excel sheet becomes with errors.

if I save with excel this file before opening with epplus the file gain 5 kbs and after saving in epplus it is ok.

so i am supposing this 5 kbs that excel 2010 adds is some missing cels information or something like that. did anyone had this problem?

 

regards.

Nov 8, 2012 at 4:17 PM

I succeed to bypass this issue by creating new sheet. strange issue.

 

          System.IO.FileInfo changedFile = new System.IO.FileInfo(@"C:\Temp\grida.xlsx");

            ExcelPackage test = new ExcelPackage(changedFile);

            test.Workbook.Worksheets.Add("newsstuff", ws.Workbook.Worksheets[1]);

            test.Save();

Dec 4, 2012 at 10:59 PM

Well, I've like the same issue. And bypass is not working to me.

Dec 5, 2012 at 12:48 AM

There are several situations which leads you to "unreadable content", please take a look at our discussion list to see if it´s not your case.