We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

System.OutOfMemoryException exporting large data

Hi,

I need export over 200k records into an excel.

This process works fine with 50k records:

            ExcelEngine excelEngine = new ExcelEngine();
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);

            IStyle style = workbook.Styles.Add("RowStyle");
            //style.Color = System.Drawing.Color.AliceBlue;
            style.Color = System.Drawing.Color.CadetBlue;
            style.Font.Bold = true;


            IWorksheet sheet = workbook.Worksheets.Create();
            sheet.Name = "Nominales";
            sheet.SetDefaultRowStyle(1, 1, style);
            sheet.ImportData((IEnumerable)lstNominales, 1, 1, true);

            workbook.Worksheets.Remove(0);
            //workbook.SaveAs(@"c:\datos\datos.xlsx");
            workbook.SaveAs("Nominales", page.Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel2010);

But now, I get this exception.

What can I do?




3 Replies

IN Ishwarya Narayanan Syncfusion Team May 5, 2016 10:07 AM UTC

Hi Manolo,

 

Thank you for contacting Syncfusion support.

 

We are unable to reproduce the reported exception from our side. So we have prepared a sample as per your requirement which can be downloaded from the following link.

 

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/XlsIO_Sample1810156344

 

Kindly share us the modified issue reproducing sample along with your machine configuration which will be helpful for us to provide you a prompt solution at the earliest. In XlsIO, There are few ways to improve the performance and memory optimization which is explained briefly in the following UG documentation link. 

 

UG documentation link: http://help.syncfusion.com/file-formats/xlsio/improving-performance  

 

Please let us know if you need any concerns.

 

Regards,

Ishwarya N



MA Manolo May 6, 2016 08:19 AM UTC

I get the error adding more data

I attach an example

Attachment: XlsIO_Sample_93041715.zip


AV Abirami Varadharajan Syncfusion Team May 9, 2016 06:05 AM UTC

Hi Manolo, 
 
Thank you for updating us. 
 
We are able to reproduce the issue “Argument out of range exception”, while running the given sample. The maximum row limit of worksheet is 1,048,576 and you are trying to import 1,197,000 rows of records which is greater than maximum row limit so “Argument out of range exception” is thrown. 
 
Kindly refer following UG documentation and MS Excel forum to know more about maximum row and column limit specification in worksheet. 
 
 
 
Please let us know if you have any concerns. 
 
Regards, 
Abirami. 


Loader.
Live Chat Icon For mobile
Up arrow icon