Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Workbook load fails with "Out of Memory"
posted

I am trying to load a .xlsx format Excel file by using the following code:

private Workbook _workbook;
using (Stream stream = fileStream)
{
     _workbook = Workbook.Load(fileStream, false);
}

The load always fails with an exception message of "Out of Memory". The stack trace is:

   at System.Drawing.Graphics.FromImage(Image image)
   at Infragistics.Documents.Excel.Serialization.Excel2007.SharedContentTypes.ImageBasePart.GetImageHolder(Stream imageStream)
   at Infragistics.Documents.Excel.Serialization.Excel2007.SharedContentTypes.ImageBasePart.Load(Excel2007WorkbookSerializationManager manager, Stream contentTypeStream)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPart(IPackagePart part)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType, Boolean isPostLoad)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPart(IPackagePart part)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType, Boolean isPostLoad)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPart(IPackagePart part)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType, Boolean isPostLoad)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPart(IPackagePart part)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType, Boolean isPostLoad)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadPartRelationships(IEnumerable`1 relationships, ContentTypeBase contentType)
   at Infragistics.Documents.Excel.Serialization.Excel2007.Excel2007WorkbookSerializationManager.LoadWorkbookContents()
   at Infragistics.Documents.Excel.Serialization.WorkbookSerializationManager.Load()
   at Infragistics.Documents.Excel.Workbook.LoadXLSXFile(Workbook workbook, Stream stream, IPackageFactory packageFactory, Boolean verifyExcel2007Xml)
   at Infragistics.Documents.Excel.Workbook.LoadHelper(Stream stream, WorkbookFormat format, String parameterName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml)
   at Infragistics.Documents.Excel.Workbook.Load(Stream stream, IPackageFactory packageFactory, Boolean verifyExcel2007Xml)
   at Infragistics.Documents.Excel.Workbook.Load(Stream stream, Boolean verifyExcel2007Xml)

Any ideas what is causing this? How can I get round this issue?