We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ImportDataTable overwrote the formatting of the column

I open a template file that has specific formatting for columns. Many of my columns are time based and the xlt sets these columns formatting to Custom [h]:mm:ss.

I check the NumberFormat on the column before calling ImportDataTable and it is set to [h]:mm:ss. The data that is being written to this column is TimeInSeconds/86400.

I check the numberformat on the column AFTER calling ImportDataTable and it is set to 0.0.

Is there anyway to avoid this or do I have to walk the range and set all time columns after the import?

4 Replies

RC Robert Chapman July 28, 2006 01:08 PM UTC

I did use PreserveTypes = true as I have strings that were being converted to datetime. My string 00:00 was displaying as mm/dd/yyyy.

So the template is set to format the time interval column as General so it displays as a string 00:00, 00:15 00:30, etc.

It also has duration columns where the data in the cell is TimeInSeconds/86400. The formatting on the template is [h]:mm:ss.

Looks like I have to find all duration columns and reset the number format. Please confirm

Thanks!


>I open a template file that has specific formatting for columns. Many of my columns are time based and the xlt sets these columns formatting to Custom [h]:mm:ss.

I check the NumberFormat on the column before calling ImportDataTable and it is set to [h]:mm:ss. The data that is being written to this column is TimeInSeconds/86400.

I check the numberformat on the column AFTER calling ImportDataTable and it is set to 0.0.

Is there anyway to avoid this or do I have to walk the range and set all time columns after the import?


AD Administrator Syncfusion Team July 29, 2006 01:45 AM UTC

Hi Rob,

I am able to see your problem. If you try to put a text formatted data into a time formatted cell, the text format will replace the time format.I tried to import datatable with preserveTypes=true but cant see any problem in

it.

Here is the sample for your reference:
ImportExportData.zip


Please take a look at the attached sample and let me know if you have any questions.

Thanks,
Bharath.


RC Robert Chapman July 31, 2006 11:44 AM UTC

I guess my post was unclear.
The cell in the template file is General. The type in the data set is string. The value of the fields in the dataset are 08:00, 08:15 08:30.

After importing the data the cell formatting becomes a time.



>Hi Rob,

I am able to see your problem. If you try to put a text formatted data into a time formatted cell, the text format will replace the time format.I tried to import datatable with preserveTypes=true but cant see any problem in

it.

Here is the sample for your reference:
ImportExportData.zip


Please take a look at the attached sample and let me know if you have any questions.

Thanks,
Bharath.


AD Administrator Syncfusion Team August 1, 2006 07:32 PM UTC

Hi Rob,

Sorry for the confusion.Please set true to the ''preserveTypes'' property of ImportDatatable so that the value of the fields in the dataset ,08:00 which are string are imported as a string in excel.

Here is the sample for your Reference:
ImportData.zip


Please take a look at the attached sample and let me know if you have any queries.

Thanks,
Bharath.

Loader.
Live Chat Icon For mobile
Up arrow icon