Search code examples
c#excelxlsxcorruptnpoi

How to save in excel 2010+ with NPOI 2.0


I use NPOI for a long time and it always works but now I need to make it work with .xlsx and at least Microsoft Office 2010. It works but when I try to open the file it says that it's corrupt and I can not repair it. Here's the error I get :

Repaired Part: /xl/worksheets/sheet1.xml part with XML error.  Load error. Line 1, column 7550.
Repaired Records: Cell information from /xl/worksheets/sheet1.xml part

Thanks for the help!

I rty with this sample and I still get the same problem : http://www.leniel.net/2014/02/npoi2.0-excel-2007-xssfworkbook-and-word-2007-xwpfdocument-support.html#sthash.T7qk6CSv.dpbs


Solution

  • I got in contact with NPOI developer and he told me this:

    it depends
    the reason may be very different
    I'm fixing a weird issue caused by SharpZip
    the zip package may also cause this issue but not on every computer

    There's a related issue here: https://npoi.codeplex.com/workitem/13046

    He updated the code with A FIX and looks like the problem went away. I'd suggest you download the code from the GitHub repo, compile it and give it a try.