Free Support Forum -

Convertstringtonumber Set DateTime to Number in ImportDataTable

I’m using Aspose.cells V and I have the same problem that we can find in the other topics (ImportDataTable- convertStringToNumber- and Dates).

I have a DataTable which contains Strings, Float and DateTime. I use this code for importing data:

worksheet.Cells.ImportDataTable(dataTables[i], true, 0, 0, dataTables[i].Rows.Count, dataTables[i].Columns.Count, true, “d-m-yyyy”, true);

and in output I have number values like 42628 for dateTime.

Do you have any suggestion for me?


Thanks for providing us some details.

I think you are already using the correct ImportDataTable() method overload. Generally, it should work fine for simple cases. Could you create a simple console demo application (runnable), zip the project and post us here (excluding Aspose.Cells assembly). Also provide your template file(s). Please do use dynamic datatable/dataset in your code (please do not use external datasource or database), so we could execute your sample to reproduce the issue. After evaluation, we may help you to figure out your issue in your code. Or alternatively we have to log a ticket (if there is no workaround in code for it) into our database to fix it.