We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export data tabel to excel

Hi Team,

I am facing some issue related to export to excel. I am using ImportDataTable like....

sheet.Cells.ImportDataTable(dataTable, true, "A1");

1. Date fields in Datatable are coming with whole things i.e. including time part.I need just MM/dd/YYYY value on My excel.

2. For null date type value its comming as default date value like 1999.......need to get blank in place of the default db values.

3. Some colums in my result set are description fields containg more than 500 characters. I want to implement Wrap text property with fixed width of column.

Please put your suggetion or if any samples are there for the same. If I will loop through all my rows in my result set it will create performance issue as I am exporting large # of records.

Thank You.



1) Please use respective overload of ImportDataTable method, e.g

Sheet.Cells.ImportDataTable(dataTable, true, 0, 0, dataTable.Rows.Count, dataTable.Columns.Count,false, “MM/dd/YYYY”, true);

2) Well, Aspose.Cells works the same way as MS Excel when inputting null or blank values while specifying datatime accordingly. Please perform you steps manually in MS Excel, if you still think Aspose.Cells works other way, kindly create a sample console application, zip it and post it here to show the issue on our end, we will check it soon.

3) Here, you have to wrap text in those cells manually by yourself using Aspose. Cells APIs as Aspose. Cells will not wrap text when you import datatable to the worksheet, see the document for your reference:

Thank you.