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.
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; 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.
Please provide feedback or comments
Did not find the solution Contact Support