Hi,
How can I change the date formats for my DateTime columms when exporting to Excel? Date column values are exported to default Excel date formats, I want to specify for example that Date values be in "yyyy-MM-dd" formats to match Mariadb DateTime column format. I tried using CellExporting event as below:
private void Options_CellExporting(object sender, DataGridCellExcelExportingEventArgs e)
{
if (e.ColumnName == "MfgDate" || e.ColumnName == "ExpiryDate")
{
e.Range.CellStyle.NumberFormat = "yyyy-MM-dd";
}
}
But it didn't do anything. Appreciate your help and suggestions.
Thanks,
Sandy