EPPlus抛出异常保存文件时出错

时间:2018-01-31 04:39:52

标签: c# .net excel epplus

我使用EPPlus与Excel一起工作。我用图片保存数据(数量1635)。保存时,它会抛出异常"错误保存文件"。在InnerException中有"类型&#34的例外;的System.OutOfMemoryException"&#34 ;. 那个StackTrace

in System.IO.MemoryStream.set_Capacity(Int32 value)
in System.IO.MemoryStream.EnsureCapacity(Int32 value)
in System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
in OfficeOpenXml.Packaging.Ionic.Zip.CountingStream.Write(Byte[] buffer, Int32 offset, Int32 count) в d:\EPPlus\Packaging\DotNetZip\Shared.cs:line 813
in OfficeOpenXml.Packaging.Ionic.Zlib.ZlibBaseStream.Write(Byte[] buffer, Int32 offset, Int32 count) in d:\EPPlus\Packaging\DotNetZip\Zlib\ZlibBaseStream.cs:line 160
in OfficeOpenXml.Packaging.Ionic.Zlib.DeflateStream.Write(Byte[] buffer, Int32 offset, Int32 count) в d:\EPPlus\Packaging\DotNetZip\Zlib\DeflateStream.cs:line 617
in OfficeOpenXml.Packaging.Ionic.Crc.CrcCalculatorStream.Write(Byte[] buffer, Int32 offset, Int32 count) в d:\EPPlus\Packaging\DotNetZip\CRC32.cs:line 710
in OfficeOpenXml.Packaging.Ionic.Zip.ZipOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count) в d:\EPPlus\Packaging\DotNetZip\ZipOutputStream.cs:line 1290
in OfficeOpenXml.Packaging.ZipPackagePart.WriteZip(ZipOutputStream os) в d:\EPPlus\Packaging\ZipPackagePart.cs:line 149

RAM = 8gb。最大尺寸图片为200kb,平均尺寸为~70kb

in OfficeOpenXml.Packaging.Ionic.Zip.CountingStream.Write(Byte[] buffer, Int32 offset, Int32 count) в d:\EPPlus\Packaging\DotNetZip\Shared.cs:line 813

值为8096,0,896。MemoryStream.Length = 161412349 我该如何解决这个问题?

0 个答案:

没有答案