简体   繁体   English

C# NPOI 库和无效的 zip 压缩

[英]C# NPOI library and invalid zip compression

I'm using the NPOI library to read and write XLSX spreadsheets in a C# application.我正在使用 NPOI 库在 C# 应用程序中读取和写入 XLSX 电子表格。 This library seems to work, I could open, write and re-open an Excel file.这个库似乎有效,我可以打开、写入和重新打开一个 Excel 文件。

I found a problem when I tried to open a NPOI file with MS Excel, its say that the file has some corrupted content.当我尝试使用 MS Excel 打开 NPOI 文件时,我发现一个问题,它说该文件有一些损坏的内容。 However NPOI library can open its file.但是 NPOI 库可以打开它的文件。 I could understand that this is a compression issue, seems that the zip compression of xlsx is not valid for Excel and this issue is caused by ICSharpCode.SharpZipLib.dll, for this reason a copy of this dll is distribuited with the NPOI library.我可以理解这是一个压缩问题,似乎 xlsx 的 zip 压缩对 Excel 无效,并且此问题是由 ICSharpCode.SharpZipLib.dll 引起的,因此此 dll 的副本与 NPOI 库一起分发。

I tried to add this dll in my project references, but the compression still doesn't work.我试图在我的项目引用中添加这个 dll,但压缩仍然不起作用。 How to solve this issue?如何解决这个问题?

尝试将 DotNetCore.NPOI 与 1.2.0 版一起使用(它对我有用)。

我建议您使用官方 NPOI 版本: https ://www.nuget.org/packages/NPOI/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM