Hi,
Thanks for the sample project and template files.
I have evaluated your scenario using your sample project a bit. Well, the issue is not with Aspose.Cells but with your data. Actually your data is strings and not numeric data or DateTime values, so you cannot apply DateTime formatting upon data and hence you cannot auto-sum right. For your issue, you may change the code segment:
i.e.,
…
Workbook workBook = new Workbook();
Worksheet workSheet = workBook.Worksheets[0];
workSheet.Cells.ImportDataTable(dt, true, “A1”);
int count = dt.Rows.Count;
for (int i = 1; i <= count ; i++)
{
Aspose.Cells.Style styleTime = workSheet.Cells[“A” + i].GetStyle();
styleTime.Custom = “h:mm:ss”;
workSheet.Cells[“A” + i].SetStyle(styleTime);
}
workSheet.AutoFitColumns();
workSheet.AutoFitRows();
with:
…
Workbook workBook = new Workbook();
Worksheet workSheet = workBook.Worksheets[0];
workSheet.Cells.ImportDataTable(dt, true, 0,0,true,true);
int count = dt.Rows.Count +1;
for (int i = 1; i <= count; i++)
{
Aspose.Cells.Style styleTime = workSheet.Cells[“A” + i].GetStyle();
styleTime.Custom = “h:mm:ss”;
workSheet.Cells[“A” + i].SetStyle(styleTime);
}
workSheet.AutoFitColumns();
workSheet.AutoFitRows();
it works fine as I tested. Actually you got to convert your so called DateTime data to numeric or appropriate data type, I choose the relevant ImportDataTable() method overload to fix it.
Thank you.