We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridExcelExport custom date format

We have a function that takes a dataset and exports it to excel using the GridExcelExport function. The problem we are having is that this is automatically converting the date format in excel to mm/dd/yyyy

We need to be able to specify the format that this comes out.

The code that we are using looks like this:

public static void ExportToExcel(this DataSet datastring filename)
		GridGroupingControl syncGrid = new GridGroupingControl();
		syncGrid.DataSource = data.Tables[0];
		GridExcelExport gridExcelExport = new GridExcelExport(syncGridfilename + ".xls");
		gridExcelExport.ExportNestedTable = true;


1 Reply

HJ Hariharan J V Syncfusion Team September 25, 2013 09:52 AM UTC

Hi Jo,
Thank you for using Syncfusion products.

Your requirement can be achieved by customizing the export cell data format in FormatExcelCellHandler event. Please refer to the following code snipptes:

protected void Button1_Click(object sender, EventArgs e)
GridExcelExport excel = new GridExcelExport(this.GridGroupingControl1, "excel.xls");
excel.ExportNestedTable = true;
//Exporting event
excel.FormatExcelCellHandler += new ExportExcelCellHandler(excel_FormatExcelCellHandler);

void excel_FormatExcelCellHandler(object sender, ExcelExportEventArgs e)
if (e.RowElement.IsRecord() && e.ExcelCell.Column == 5) // condition to check the record and column as 5th column(Date column)
// set the format for specified cell data.
e.ExcelCell.Cells[0].NumberFormat = "m/d/yyyy";

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

Sample: www.syncfusion.com/downloads/support/directtrac/general/export-1432353488.zip

Please let us know if you need any further assistance.

Hariharan J.V.

Live Chat Icon For mobile
Up arrow icon