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

Export to Excel from GDBG, problem with date types...

Thread ID:





67847 Aug 31,2007 07:39 PM UTC Sep 3,2007 11:29 PM UTC WinForms 4
Tags: GridControl
Asked On August 31, 2007 07:39 PM UTC

I am using GDBG version 4.4.xxx
One of my columns in the grid is of type Date

I am exporting the rows from the grid to excel using GridExcelConvertorControl

GridDataBoundGrid exportGrid = new GridDataBoundGrid();
exportGrid.DataSource = dt //my data table;

GridExcelConverterControl gecc = new GridExcelConverterControl();
gecc.GridToExcel(exportGrid.Model, sFileName, ConverterOptions.RowHeaders | ConverterOptions.Visible);

For most part it works ok. However the Date type is getting exported into some numbers.

Looks like the Excel column format that is suppose to show date is not getting set correctly.

Is there a way programattically, such that I can specify the format for each cell programatically prior to export?

J.Nagarajan [Syncfusion]
Replied On September 1, 2007 01:34 AM UTC

Hi Pratima,

If you set the GridStyleInfo.StyleInfo.Format property for your DateTime column, then the export should work ok. Here is the sample we ship created to show this idea.


Let us know if this is not what you wanted.


Replied On September 1, 2007 02:55 AM UTC

My Grid's datasource is a SQL DataTable which already has the field of type DateTime

Which means grid is automatically creating a column of type DateTime isn't it?

Do I need to explicitly reset the exact same format again?


Replied On September 1, 2007 03:11 AM UTC

OK, so looks like the problem is how I set the format.

For example.

1) If I set the format = "mm/dd/yyyy"

Grid displays it properly
Exported file shows it properly

2) If I set the format = "d" ( which is syncfusion's format for short date )

Grid Displays it properly
Exported file DOES NOT show it correctly. I see the 39325.80 in the excel spreadsheet

Looks like a bug in Grid convertor which doesn't recognize the coded format from GDBG

Rajagopal [Syncfusion]
Replied On September 3, 2007 11:29 PM UTC

Hi Pratima,

Thanks for your patience.

We are not able to see this issue in the latest version 5.1.x.x. This has been internally fixed in the latest version of Essential Studio 5.1.

As a workaround, you can handle the QueryCellInfo event and apply the FormattedText to the datetime cells in grid. Please refer the below sample that shows this working fine.


Let me know if you have any other questions.

Have a nice time.


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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