Articles in this section
Category / Section

How to avoid out of memory exception while exporting GridControl to Excel?

1 min read

The out of memory exception occurs while exporting the GridControl with more number of rows and columns. This exception occurs because new cell style will be created for each and every cell in XlsIO while exporting.

 

Hence you can overcome this issue by setting the property ExportStyle of ExcelExportingOptions as false. Please find the code example for your reference.  

  

C#

 

var options = new ExcelExportingOptions();  
options.ExportStyle = false;  
ExcelEngine excelEngine = new ExcelEngine();  
IWorkbook workbook = excelEngine.Excel.Workbooks.Add();  
workbook.Version = ExcelVersion.Excel2013;  
IWorksheet workSheet = workbook.Worksheets[0];  
gridControl.Model.ExportToExcel(workSheet, options);  
workbook.SaveAs("Sample.xlsx");  
System.Diagnostics.Process.Start(@"Sample.xlsx");  
 

 

Note: While using this option, cell styles are not exported. It will export the cell content only. 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied