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?
Parents
No Data
Reply
  • 17475
    Offline posted

    Hello, 

    Thank you for posting! 

    I have created a sample project trying to reproduce the behavior you have described. In the attached project a filestream is used to load data from excel file and populate it in a grid. No exception occurs when running this application on my side. Would you please try to load it and let me know if the error message is thrown? Please note the the path for the file should be changed according to the projects location on your computer. Could you give me more details about the excel file you are trying to load? Does it contain lots of worksheets, rows and columns? It will be very helpful if you could modify the attached project so that it represents your issue. Thank you.

    ExcelImportRounding.zip
Children