Hello,
I have some problem with Export to Excel for DateTime Format Columns.
Set Column Format:
(this.myGrid.Columns["JPr_MinStart"] as GridViewDataColumn).DataFormatString = "dd/MM/yyyy hh:mm";
On ElementExportingToDocument:
01.private void myGrid_ElementExportingToDocument(object sender, GridViewElementExportingToDocumentEventArgs e)02.{03. if (e.Element == ExportElement.Cell)04. {05. var cellExportingArgs = e as GridViewCellExportingEventArgs;06. if (07. (cellExportingArgs.Column as GridViewDataColumn).UniqueName == "JPr_MinStart"08. )09. {10. (cellExportingArgs.Column as GridViewDataColumn).DataFormatString = string.Empty;11. var parameters = cellExportingArgs.VisualParameters as GridViewDocumentVisualExportParameters;12. parameters.Style = new CellSelectionStyle()13. {14. Format = new CellValueFormat("dd/MM/yyyy hh:mm")15. };16. }17. }18.}On ElementExportedToDocument
private void myGrid_ElementExportedToDocument(object sender, GridViewElementExportedToDocumentEventArgs e) {if (e.Element == ExportElement.Table){ (this.myGrid.Columns["JPr_MinStart"] as GridViewDataColumn).DataFormatString = "dd/MM/yyyy hh:mm";} }
If I set DateFormatString, the export to Excel is wrong. It export the value as String and Excel cannot recognize the DateTime column.
If i remove DateFormatString on Exporting and on Exported I set the DateFormat string, the Excel is right but the first line no!
I think that is a bug? My WPF version is: 2018.1.220.40
Thank you very much
