GridExcelExportFormat.Xlsx Date formatting issue

Posted by Community Admin on 04-Aug-2018 04:56

GridExcelExportFormat.Xlsx Date formatting issue

All Replies

Posted by Community Admin on 14-Jan-2016 00:00

Hi Everyone,

if I do not set export format i.e (RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx)

grid will be exported as Excel 97-2003 format and Date cells formatted as they are displayed in the grid. 

However once I set it (RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx) 

cell containing dates are formatted differently to how they displayed in the Grid.

Is it a bug, how can I get particular cells to preserve their formatting. 

Cheers,

Alex

Posted by Community Admin on 18-Jan-2016 00:00

Hi Alex,

By default Excel is trying to "guess" the content of its cells. Moreover, it applies format depending on the culture of the machine where the file is opened. Because of this the date format in the Excel file may be different.

If you would like to ensure that Excel will show the date as expected you need to explicitly specify the format for the cells. Check out the following article that describes the approach.





Regards,
Viktor Tachev
Telerik
 

Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

 

This thread is closed