Cells.importdatatable and excel.save-method take very long


#1

Hello,

I'm currently testing your ASPOSE.Excel-component (Version 3.4.4.0).

cells.importdatatable and excel.save-method take very long trying to save

a datatable with 10000 rows and 96 columns.

In comparison with COM it takes much longer - where is my mistake ?!

Enclosed please find the code:

AnzRow = MyDT.Rows.Count

AnzCol = MyDT.Columns.Count

MyExcel = New Aspose.Excel.Excel

mycells.ImportDataTable(MyDT, True, 0, 0, AnzRow, AnzCol)

AspExcel.Save("C:\test.xls", FileFormatType.Excel2000)

I would be very happy if you could help me.

Regards,

Manuela


#2

How long does it take to import a 10000 row 96 column datatable in your machine? The following is my test code and it take about 11 seconds to import data and 21 seconds to save the file. The generated file is about 23MB.

I use a Pentium M 1.4G laptop with 512MB memory.

DataTable dt = new DataTable();
for(int i = 0; i < 96; i ++)
{
dt.Columns.Add();
}
for(int i = 0; i < 10000; i ++)
{
DataRow row = dt.NewRow();
for(int j = 0; j < 96; j ++)
{
if(j % 4 == 0)
row[j] = "hello" + (i * 100 + j).ToString();
else
row[j] = i * 100 + j;
}

dt.Rows.Add(row);
}

DateTime time1 = DateTime.Now;

Excel excel = new Excel();
excel.Worksheets[0].Cells.ImportDataTable(dt, true, 0, 0, dt.Rows.Count, dt.Columns.Count);

DateTime time2 = DateTime.Now;

TimeSpan span = time2 - time1;

Console.WriteLine(span.TotalSeconds);

excel.Save("d:\\test\\abc.xls", FileFormatType.Excel2000);

DateTime time3 = DateTime.Now;

span = time3 - time2;

Console.WriteLine(span.TotalSeconds);