Say, I am trying to create a large excel workbook with 20000 rows. I find that the amount of memory it uses on the server is extremely high, most times causing an outofmemory exception.
This is basically how i generate my files. Is there a better way of doing it which won't cause such a delay/memory usage. Thanks.
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense("../Aspose.Total.lic");
Aspose.Cells.Workbook excel = new Aspose.Cells.Workbook();
Aspose.Cells.Worksheet sheet = excel.Worksheets[0];
SqlDataReader sqlDataReader = SqlHelper.ExecuteReader(DB.ConnectionString, CommandType.Text, sql);
sheet.Cells.ImportFromDataReader(sqlDataReader, true, 1, 1, false);
if (includeAutoFilter)
{
sheet.AutoFilter.Range = "A2:Z2";
}
sheet.AutoFitColumn(0);
sheet.AutoFitColumn(1);
sheet.AutoFitColumn(2);
sheet.AutoFitColumn(3);
sheet.AutoFitColumn(4);
sheet.AutoFitColumn(5);
sheet.AutoFitColumn(6);
sheet.AutoFitColumn(7);
sheet.AutoFitColumn(8);
sheet.AutoFitColumn(9);
//}
sheet.FreezePanes("A3", 3, 1);
sheet.Cells["A1"].PutValue(title);
sheet.Cells["A1"].Style.Font.IsBold = true;
excel.Save(title + ".xls", Aspose.Cells.FileFormatType.Excel97, Aspose.Cells.SaveType.OpenInExcel, httpResp);