GridExcelExportFormat.Xlsx Date formatting issue - Bugs & Issues - Bugs & Issues - Progress Community

GridExcelExportFormat.Xlsx Date formatting issue

 Bugs & Issues

GridExcelExportFormat.Xlsx Date formatting issue

  • GridExcelExportFormat.Xlsx Date formatting issue
  • 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

  • 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.