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

how to export a grid to an excel file with the header names?

Thread ID:





101077 Sep 23,2011 05:05 PM UTC Sep 27,2011 04:48 AM UTC ASP.NET Web Forms (Classic) 2
Tags: GridGroupingControl
Asked On September 23, 2011 05:05 PM UTC

I want to export the content of a grid made of 2 datatables linked together (one is the child of the other) to an excel file. In order to do that I use the following code:
GroupingGridExcelConverterControl converter = new GroupingGridExcelConverterControl();
converter.GroupingGridToExcel(grid, "test.xls", ConverterOptions.ColumnHeaders);
The problem with that is that it uses the names of the datatable fields when I actually want to see in my excel file the header names. I thought that putting ConverterOptions.ColumnHeaders would make the trick but it doesn't. I have something like this:
client_name, client_id
when I actually want to see the headers name that I have set:
Name, Id
Can you tell me how to achieve this please?

Replied On September 23, 2011 05:27 PM UTC

It does the same whenever I try to put ConverterOptions.RowHeaders instead of ConverterOptions.ColumnHeaders

And it also does the same when I try to put ConverterOptions.ColumnHeaders|ConverterOptions.RowHeaders instead of ConverterOptions.ColumnHeaders

Ragamathulla B [Syncfusion]
Replied On September 27, 2011 04:48 AM UTC

Hi Julien,

Thank you for your interest in syncfusion products.

You can handle this operation through ‘QueryImportExportCellInfo’ event along with the following code and also set the ConverterOptions to ‘ColumnHeaders’.

//In buttonAdv1_Click.

gec.GridToExcel(this.gridControl1.Model, workBook.Worksheets[0],ConverterOptions.ColumnHeaders );

Please refer to the following sample which illustrates the same.


Let me know if you have any other concerns.

Ragamathullah B.


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

This page will automatically be redirected to the 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