如何使用NPOI 2.0保存excel 2010+

时间:2023-01-15 08:40:46

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 :

我使用NPOI很长一段时间它总是有效但现在我需要使用.xlsx和至少Microsoft Office 2010.它可以工作,但当我尝试打开文件时它说它已损坏我无法修复它。这是我得到的错误:

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

我带着这个样本,我仍然遇到同样的问题:http://www.leniel.net/2014/02/npoi2.0-excel-2007-xssfworkbook-and-word-2007-xwpfdocument-support.html#sthash .T7qk6CSv.dpbs

1 个解决方案

#1


4  

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

我与NPOI开发人员联系过,他告诉我这个:

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

这取决于原因可能是非常不同我正在修复由SharpZip引起的奇怪问题zip包也可能导致这个问题但不是每台计算机上都有

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

这里有一个相关的问题: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.

他用A FIX更新了代码,看起来问题就消失了。我建议你从GitHub repo下载代码,编译它并尝试一下。

#1


4  

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

我与NPOI开发人员联系过,他告诉我这个:

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

这取决于原因可能是非常不同我正在修复由SharpZip引起的奇怪问题zip包也可能导致这个问题但不是每台计算机上都有

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

这里有一个相关的问题: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.

他用A FIX更新了代码,看起来问题就消失了。我建议你从GitHub repo下载代码,编译它并尝试一下。