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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridExcelExport custom date format

Thread ID:





112442 Sep 23,2013 09:59 PM UTC Sep 25,2013 09:52 AM UTC ASP.NET Web Forms (Classic) 1
Tags: GridGroupingControl
Jo Scothern
Asked On September 23, 2013 09:59 PM UTC

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;


Hariharan J V [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon