This is a migrated thread and some comments may be shown as answers.

Excel export DateTime

2 Answers 231 Views
GridView
This is a migrated thread and some comments may be shown as answers.
IT Development
Top achievements
Rank 1
IT Development asked on 19 Aug 2010, 02:32 PM

Hello,

Have a gridview that I want to export to excel  using the radcontrol for winforms 2010 q2 sp1.

I’m using the ExportToExcelML class.

The problem is that in excel the time is added like for example  2001-05-09T00:00:00.000

On the gridview column I’m setting the export format string.

GridViewDataColumn gridviewColumn;

PropertyInfo propertie = Helper.GetProductieMonitorPropertie(kolom);

if (propertie.PropertyType == typeof(DateTime))

{

   gridviewColumn = new GridViewDateTimeColumn();

   gridviewColumn.ExcelExportFormatString = "dd.MM.yyyy";

   gridviewColumn.ExcelExportType = DisplayFormatType.Text;

   gridviewColumn.FormatString = "{0:d}";

}

 

Any suggestion?

 

Kind regards,

 

Tim van Rooijen

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 24 Aug 2010, 05:07 PM
Hello Tim,

Thank you for writing.

You have experienced the described format issues, because you must set ExcelExportType to Custom if you want to use custom format string:
gridviewColumn.ExcelExportFormatString = "dd.MM.yyyy";
//gridviewColumn.ExcelExportType = DisplayFormatType.Text;
gridviewColumn.ExcelExportType = DisplayFormatType.Custom;

I hope this helps. Let me know if you have any additional questions.

All the best,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
IT Development
Top achievements
Rank 1
answered on 25 Aug 2010, 12:24 PM
Problem solved

 Thanks
Tags
GridView
Asked by
IT Development
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
IT Development
Top achievements
Rank 1
Share this question
or