I am using ExportToExcel and successfully generate an XLSX file from a RadGrid. Here is my event handler that is triggered from a custom button, not the built-in export button:
lvSearchResults.ExportSettings.FileName =
"bla"
;
lvSearchResults.ExportSettings.IgnorePaging =
true
;
lvSearchResults.ExportSettings.OpenInNewWindow =
true
;
lvSearchResults.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
lvSearchResults.ExportSettings.Excel.FileExtension =
"xlsx"
;
lvSearchResults.MasterTableView.ExportToExcel();
My problem is that date columns are displayed correctly in the browser, but they are wrong and also changing in the resulting Excel file. I set the data format for my date columns as follows (as I generate all columns programmatically):
GridBoundColumn colEintritt =
new
GridBoundColumn();
lvSearchResultsMasterTableView.Columns.Add( colEintritt );
colEintritt.HeaderText = Glo.EwdFields.Eintritt;
colEintritt.DataField =
"Eintrittsdatum"
;
colEintritt.DataFormatString =
"{0:dd.MM.yyyy}"
;
The Excel file has dates with a "wrong german" formatting, MM.dd.yyyy, and also MM/dd/yyyy. I cannot see why it formats one line like this and one like that. I'd be glad for a hint on how to get this correct.
Thanks and best regards,
Helge