Thursday, October 31, 2013

The underlying compression routine could not reserve sufficient memory

I get this error when saving very large excel documents using DocumentFormat.OpenXml (Workbookpart.Workbook.Save()).


This was never a problem in the past with much larger Excel documents. This problem started after installing .NET 4.5.


The following is the stack trace when the error is thrown:


at System.IO.Compression.DeflaterZLib.DeflateInit(CompressionLevel compressionLevel, Int32 windowBits, Int32 memLevel, CompressionStrategy strategy) at System.IO.Compression.DeflaterZLib..ctor(CompressionLevel compressionLevel) at System.IO.Compression.DeflateStream.CreateDeflater(Nullable`1 compressionLevel) at System.IO.Compression.DeflateStream..ctor(Stream stream, CompressionMode mode, Boolean leaveOpen) at MS.Internal.IO.Packaging.CompressStream.ChangeMode(Mode newMode) at MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) at MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] buffer, Int32 offset, Int32 count) at MS.Internal.IO.Zip.ZipIOModeEnforcingStream.Write(Byte[] buffer, Int32 offset, Int32 count) at MS.Internal.IO.Packaging.IgnoreFlushAndCloseStream.Write(Byte[] buf, Int32 offset, Int32 count) at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.StreamWriter.Close() at System.Xml.XmlTextWriter.Close() at System.Xml.XmlWriter.Dispose(Boolean disposing) at System.Xml.XmlWriter.Dispose() at MS.Internal.IO.Packaging.InternalRelationshipCollection.WriteRelationshipPart(PackagePart part) at MS.Internal.IO.Packaging.InternalRelationshipCollection.Flush() at System.IO.Packaging.PackagePart.FlushRelationships() at System.IO.Packaging.PackagePart.CloseRelationships() at System.IO.Packaging.Package.DoCloseRelationshipsXml(PackagePart p) at System.IO.Packaging.Package.DoOperationOnEachPart(PartOperation operation) at System.IO.Packaging.Package.System.IDisposable.Dispose() at System.IO.Packaging.Package.Close() at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing) at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose() at SEToolkit.Reports.Plugins.ReportsPlugin.Controllers.ExcelControllers.ComputersExcellController.createNewComputersExcel(String fileName, List`1 epm)


Any ideas? I cannot make the documents smaller and I don't want to use interop. Office should not be installed on the machines generating these reports.


Thanks


No comments:

Post a Comment