This project has moved and is read-only. For the latest updates, please go here.

An exception 'System.OutOfMemoryException' occured while genrating an Excel

Jul 24, 2014 at 8:03 AM
Edited Jul 24, 2014 at 8:04 AM

I am trying to generate Excel from data table 'dtResult'. Which consists about 80 columns & 300000 rows. An exception 'System.OutOfMemoryException' occured while genrating an Excel, below is code to generate an excel :

using (ExcelPackage package = new ExcelPackage(newFile))
            ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(excelSheetName);
            worksheet.Cells["A1"].LoadFromDataTable(dtResult, true, TableStyles.None);
When I tried to create by running the code then it successfully generated an excel file. But when try to create by executable on server then it gives an exception.

Please provide some solution to overcome this issue.

Pankaj Rai