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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ImportDataTable overwrote the formatting of the column

Thread ID:

Created:

Updated:

Platform:

Replies:

47140 Jul 28,2006 12:38 PM UTC Aug 1,2006 07:32 PM UTC WinForms 4
loading
Tags: XlsIO
Robert Chapman
Asked On July 28, 2006 12:38 PM UTC

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?

Robert Chapman
Replied On 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?

Administrator [Syncfusion]
Replied On 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.

Robert Chapman
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;