Hi
We use the following code to export data from SQL Server to Excel on the web server which then sends down to users.
When running on a relatively large dataset e.g. 25000 lines, then it takes half an hour.
We know the database query is not the problem because if we run it manually, it only takes 4 seconds.
Please advise if there is a more efficient way than what I am doing below.
Thanks
Fred
// retrieve data into DataSet from database into dsExport
Workbook workbook = new Workbook();
workbook.Version = Spire.Xls.ExcelVersion.Version97to2003;
Worksheet worksheet = workbook.Worksheets[0];
worksheet.InsertDataTable(dsExport.Tables[0], true, 1, 1);
for (int i = 1; i <= worksheet.Columns.Length; i++)
{
worksheet.AutoFitColumn(i);
}
workbook.SaveToHttpResponse("export.xls", Response);
Response.Flush();