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.
Unfortunately, activation email could not send to your email. Please try again.

SfDataGrid export to Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

118396 Mar 4,2015 03:19 PM Sep 24,2018 10:53 PM WPF 13
loading
Tags: SfDataGrid
Constantin Patak
Asked On March 4, 2015 03:19 PM

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.


Ashok N [Syncfusion]
Replied On March 5, 2015 04:48 AM

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 :

S.No

Query

Comments

1.

GridStackHeadersDescriptors of the SfDataGrid do not appear in the excel Worksheet

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

2.

Excel Worksheet contains also the hidden columns

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

3.

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.

Thanks,

Ashok



Constantin Patak
Replied On March 5, 2015 08:55 AM

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.

Ashok N [Syncfusion]
Replied On March 6, 2015 02:28 AM

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.

Thanks,

Ashok



Cris Perry
Replied On July 10, 2018 03:25 PM

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 16.1.0.26 of the Syncfusion DLLs, which is currently the latest stable version.

Attachment: GridExportTestUtility_93a395c1.zip

Sathiyathanam Jeyakumar [Syncfusion]
Replied On July 11, 2018 06:09 AM

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. 
 
Regards, 
Sathiyathanam

Cris Perry
Replied On July 11, 2018 07:03 AM

Thank you for your quick response.

Sathiyathanam Jeyakumar [Syncfusion]
Replied On July 12, 2018 07:10 AM

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

Cris Perry
Replied On August 29, 2018 09:36 AM

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

Deivaselvan Y [Syncfusion]
Replied On August 30, 2018 06:31 AM

Hi Cris,

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

https://www.syncfusion.com/forums/138986/essential-studio-2018-volume-2-service-pack-release-v16-2-0-46-available-for-download

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.

https://www.syncfusion.com/forums/139512/essential-studio-2018-volume-2-service-pack-release-v16-2-0-50-available-for-download

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.

Regards,
Deivaselvan
 


Cris Perry
Replied On September 10, 2018 04:22 PM

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

Deivaselvan Y [Syncfusion]
Replied On September 11, 2018 12:09 AM

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 16.1.0.24 release as a latest stable package instead of 16.2.0.50. 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  
Syncfusion.SfGrid.WPF40  
   
Syncfusion.SfGrid.WPF45  
   
Syncfusion.SfGrid.WPF451  
   
Syncfusion.SfGrid.WPF46  
Syncfusion.SfGrid.WPF  

Please refer the below article more details on this changes and let us know if this helps you.
https://www.syncfusion.com/kb/8614/syncfusion-nuget-package-structure-changes 

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.
https://help.syncfusion.com/common/essential-studio/licensing/license-key
https://help.syncfusion.com/common/essential-studio/licensing/license-key#wpf

Please let us know if you have any other questions.

Regards,
Deivaselvan 


Cris Perry
Replied On September 18, 2018 11:54 AM

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 16.2.0.50).

Attachment: GridExportTestUtility_7f94fb9f.zip

Shobika Palani [Syncfusion]
Replied On September 24, 2018 10:53 PM

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.
 

Regards,
Shobika
 


CONFIRMATION

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.

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.

;