Failed to create a very large file
When I have more than 100000 rows gives me the following error
__Row = 183 706__ - System.OutOfMemoryException: An unhandled exception of type 'System.OutOfMemoryException'. in DocumentFormat.OpenXml.OpenXmlChildElements.GetEnumerator () in DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml.OpenXmlElement.WriteTo (XmlWriter xmlWriter) at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml .OpenXmlElement.WriteTo (XmlWriter xmlWriter) at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml.OpenXmlElement.WriteTo (XmlWriter xmlWriter) at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml.OpenXmlPartRootElement .WriteTo (XmlWriter xmlWriter) in DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart (OpenXmlPart openXmlPart) in DocumentFormat.OpenXml.OpenXmlPartRootElement.Save () in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContent (OpenXmlPart part) in DocumentFormat.OpenXml.Packaging.OpenXmlPackage .TrySavePartContent (OpenXmlPart part) in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents () in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose (Boolean disposing) in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose () in ClosedXML.Excel.XLWorkbook .CreatePackage (String filePath) at ClosedXML.Excel.XLWorkbook.SaveAs (String file) in WebApplication.Reporte12.Obsolecencia.GenerarExcel (Int64 IdSociedad) in ....
according to the program when I add a new sheet the range is __[ClosedXML.Excel.XLWorksheet] = {'Sheet1'! A1: XFD1048576} __
the error is when __wb.SaveAs(file);__
Comments: If the problem is now only with a webform application. Make sure the IIS thread pool is not set to a 32bit application. See https://help.webcontrolcenter.com/kb/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx except you want to make sure Enable 32Bit = false. If you application does require 32bit, then you may have to have your ClosedXML generation code run in its own thread pool. Hope this helps.
When I have more than 100000 rows gives me the following error
__Row = 183 706__ - System.OutOfMemoryException: An unhandled exception of type 'System.OutOfMemoryException'. in DocumentFormat.OpenXml.OpenXmlChildElements.GetEnumerator () in DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml.OpenXmlElement.WriteTo (XmlWriter xmlWriter) at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml .OpenXmlElement.WriteTo (XmlWriter xmlWriter) at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml.OpenXmlElement.WriteTo (XmlWriter xmlWriter) at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo (XmlWriter w) at DocumentFormat.OpenXml.OpenXmlPartRootElement .WriteTo (XmlWriter xmlWriter) in DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart (OpenXmlPart openXmlPart) in DocumentFormat.OpenXml.OpenXmlPartRootElement.Save () in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContent (OpenXmlPart part) in DocumentFormat.OpenXml.Packaging.OpenXmlPackage .TrySavePartContent (OpenXmlPart part) in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents () in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose (Boolean disposing) in DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose () in ClosedXML.Excel.XLWorkbook .CreatePackage (String filePath) at ClosedXML.Excel.XLWorkbook.SaveAs (String file) in WebApplication.Reporte12.Obsolecencia.GenerarExcel (Int64 IdSociedad) in ....
according to the program when I add a new sheet the range is __[ClosedXML.Excel.XLWorksheet] = {'Sheet1'! A1: XFD1048576} __
the error is when __wb.SaveAs(file);__
Comments: If the problem is now only with a webform application. Make sure the IIS thread pool is not set to a 32bit application. See https://help.webcontrolcenter.com/kb/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx except you want to make sure Enable 32Bit = false. If you application does require 32bit, then you may have to have your ClosedXML generation code run in its own thread pool. Hope this helps.