NPOI icon indicating copy to clipboard operation
NPOI copied to clipboard

1.2.0版本在上传xlsx文件导入中出现错误

Open ispwd opened this issue 6 years ago • 0 comments

代码简写如下: var files = Request.Form.Files; var file = files.FirstOrDefault(); var fs = file.OpenReadStream(); workbook = new XSSFWorkbook(fs); //这里报错,已知文件为xlsx文件无疑,NPOI本身导出的文件上传无问题,但是Excel2016编辑过后再上传导入就会出现该问题。同时测试了直接从本地通过System.IO.File打开本地同样的文件不会出现该问题。 升级到1.2.0出现该问题,之前使用1.0.2无该问题。 测试降级到1.0.2版本后以上问题消失。

ZipException: Invalid input data ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(byte[] buffer, int offset, int count) ICSharpCode.SharpZipLib.Zip.ZipInputStream.BodyRead(byte[] buffer, int offset, int count) NPOI.OpenXml4Net.Util.ZipInputStreamZipEntrySource+FakeZipEntry..ctor(ZipEntry entry, ZipInputStream inp) NPOI.OpenXml4Net.Util.ZipInputStreamZipEntrySource..ctor(ZipInputStream inp) NPOI.OpenXml4Net.OPC.ZipPackage..ctor(Stream filestream, PackageAccess access) NPOI.OpenXml4Net.OPC.OPCPackage.Open(Stream in1) NPOI.Util.PackageHelper.Open(Stream is1) NPOI.XSSF.UserModel.XSSFWorkbook..ctor(Stream is1)

ispwd avatar Aug 17 '18 04:08 ispwd