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

SfDataGrid export to Excel

We have created a SfDataGrid code behind and we want to export it to Excel. We are using the ExportToExcel function, but we are facing the following problems:
  • The GridStackHeadersDescriptors of the SfDataGrid do not appear in the excel Worksheet
  • The excel Worksheet contains also the hidden columns
  • The excel Worksheet does not contain any style (background color, foreground color, etc) at all.

What we want is the exported worksheet and the SfDataGrid to have the same appearance. Is there anything you can do to help us?

We are looking forward your reply ASAP.

Thank you.

13 Replies

AN Ashok N Syncfusion Team March 5, 2015 09:48 AM UTC

Hi Constantin,

Thank you for contacting Syncfusion Support.

We have analyzed your query and please find the solution for your queries from the below table :





GridStackHeadersDescriptors of the SfDataGrid do not appear in the excel Worksheet

You can achieve this by setting ExcelExportingOptions.ExportStackedHeaders to True.


Excel Worksheet contains also the hidden columns

We have analyzed your query and you can achieve your requirement by using ExcelExportingOptions.ExcludeColumns property.


Excel Worksheet does not contain any style (background color, foreground color, etc) at all.

We regret to inform you that this is default behavior of SfDataGrid. But, you can set the style to Excel sheet in Exporting time by handling CellExportingHandler and ExportingEventHandler.

We have prepared a sample based on your all requirement and attached in the below sample link for your reference:

Sample link: http://www.syncfusion.com/downloads/support/directtrac/118396/ExportToExcel-894322957.zip

Please let us know if you require further assistance.



CP Constantin Patak March 5, 2015 01:55 PM UTC

Hi Ashok,

First of all I would like to thank you very much for your prompt reply.

We tried to run the sample code that you have sent us, but we cannot build it because we have the following error:
 "'Syncfusion.UI.Xaml.Grid.Converter.ExcelExportingOptions' does not contain a definition for 'ExportStackedHeaders' and no extension method 'ExportStackedHeaders' accepting a first argument of type 'Syncfusion.UI.Xaml.Grid.Converter.ExcelExportingOptions' could be found (are you missing a using directive or an assembly reference?)"

Note that we are using the 12.1451.0.43 Syncfusion version. Could this be the problem? If yes, what can we do about this? If not, is there anything else we could try?

We're waiting for your reply.

Thanks in advance.

AN Ashok N Syncfusion Team March 6, 2015 07:28 AM UTC

Hi Constantin,

We are sorry about the inconvenience caused.

We have analyzed your query and we have provided support for ExcelExportingOptions.ExportStackedHeaders in 12.2 version. So, we request you to upgrade your product version to our current version in order to get the fix for this issue.

Please let us know if you require further assistance.



CP Cris Perry July 10, 2018 07:25 PM UTC

There is an issue with the Excel export if you include stacked headers and hide certain columns.  A sample application demonstrating the behavior is attached.

In the sample application, the grid displays as follows:

I would like to export the Name column only to Excel.  To do so, in code I have added the Primary, Secondary, and Tertiary columns to the Exclude column list.  However the Excel export shows:

As you can see, the Languages Spoken stacked header appears in the export although the "child" columns are hidden.

The application is built using .NET 4.0, however, I have tried multiple versions of .NET including 4.7.  I am using NuGet version of the Syncfusion DLLs, which is currently the latest stable version.

Attachment: GridExportTestUtility_93a395c1.zip

SJ Sathiyathanam Jeyakumar Syncfusion Team July 11, 2018 10:09 AM UTC

Hi Cris, 
Thank you for contacting syncfusion support. 
We are able to reproduce the repoted issue “Export to excel is not working properly for stacked headers”. we have logged the bug report on this.  
This fix will be included in our Volume 2 SP1 release which will be available in August 2018. 

CP Cris Perry July 11, 2018 11:03 AM UTC

Thank you for your quick response.

SJ Sathiyathanam Jeyakumar Syncfusion Team July 12, 2018 11:10 AM UTC

Hi Cris, 
Thank you for your update. 
We will update you once this issue fix included in Volumn 2 SP1 release. 

CP Cris Perry August 29, 2018 01:36 PM UTC

Is this fixed in version, released on 8/1/2018?

DY Deivaselvan Y Syncfusion Team August 30, 2018 10:31 AM UTC

Hi Cris,

Yes, the reported issue has been fixed and included in our 2018 Volume 2 SP1 ( release and is available for download under the following link.


We are glad to announce that our Essential Studio Volume  2  SP2 2018 (
v16.2.0.50) also rolled out and is available for download under the following link. This latest version has the fix for your reported issue.


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


CP Cris Perry September 10, 2018 08:22 PM UTC

When will this be available via NuGet?  The latest NuGet package showing in Visual Studio is

DY Deivaselvan Y Syncfusion Team September 11, 2018 04:09 AM UTC

Hi Cris,

We have provided separate NuGet packages for each .NET Framework version assembly till v16.1.0.24. We suspect that you may using the old package name and so it shows the release as a latest stable package instead of From Essential Studio 2018 Volume 1 SP 1 release (v16.1.0.32) onwards each NuGet package will contain all applicable .NET Framework versions for the Syncfusion component.

Example NuGet package structure changes have been shown below  
Component Name  
Till v16.1.0.24  
From v16.1.0.32  
Grid WPF  

Please refer the below article more details on this changes and let us know if this helps you.

We have introduced a new licensing system starting with version 16.2.0.x release of Essential Studio. These changes apply to all evaluators and only to paid customers who use NuGet packages. Starting with v16.2.0.x, if you reference Syncfusion assemblies from evaluation builds or from the NuGet feed, you also must include a license key in your projects.

Refer the below documentation to get license key and code example on how it can be registered in your WPF application.

Please let us know if you have any other questions.


CP Cris Perry September 18, 2018 03:54 PM UTC

The issue has been fixed but your team has introduced a new issue.

In the attached sample there are 3 groups of columns, each containing a stacked header.  If we hide the middle group, the first group's stacked header label disappears.

As an FYI, this problem only seems to occur when there are several individual columns to the left of the first stacked header group.

We are using .NET 4 and Syncfusion version 16.2450.0.50 (NuGet

Attachment: GridExportTestUtility_7f94fb9f.zip

SP Shobika Palani Syncfusion Team September 25, 2018 02:53 AM UTC

Hi Cris,

We can reproduce the reported issue with the given sample and our developer has confirmed it as a defect. We have logged a defect report for this and this fix will be available in Volume 3 Service Pack 1 Release 2018.


Live Chat Icon For mobile
Up arrow icon