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

Export to Excel with styles

I'm trying to export some SfDataGrid to Excel using the ExportToExcel extension method. Since I'm using a base class as exporter, is there a way to export the SfDataGrid along with its styles? The CellExporting event allows only styling based on CellValue/CellType, so instead of having different options_CellExporting ​listener (see snippet below), is it possible to have something similar to the FindResource ​method in WPF that can get all of the cell style and apply them on the exported Excel?  How to export the SfDataGrid to Excel with styles | WPF - SfDataGrid (syncfusion.com)

var options = new ExcelExportingOptions();
options.CellExporting +=options_CellExporting;

3 Replies

DM Dhanasekar Mohanraj Syncfusion Team December 16, 2022 08:02 AM UTC

Alison Tan,


We have checked the feasibility to achieve your requirement. In that, with the WinForms, we do not have any equivalent ways to export the Styles as you mentioned. However, you can export the SfDataGrid along with all the applied styles. Currently, ExportToExcel does not export the Datagrid along with the applied styles. We have logged this as a bug “Applied styles do not export properly while exporting the SfDataGrid to Excel” We will include this fix in our NuGet release which is scheduled on January 03, 2023.


You can track the status of this report through the following feedback link,

Feedback Link: https://www.syncfusion.com/feedback/39753/applied-styles-do-not-export-properly-while-exporting-the-sfdatagrid-to-excel


Note: The provided feedback link is private, and you need to log in to view this feedback.


We appreciate your patience until then.



DM Dhanasekar Mohanraj Syncfusion Team January 4, 2023 01:53 PM UTC

Alison Tan,

We are unable to include the fix for this issue in our NuGet package which is released today. We will fix this issue and include it in our Weekly NuGet release scheduled for January 10, 2023. We appreciate your patience until then.



DM Dhanasekar Mohanraj Syncfusion Team January 10, 2023 11:54 AM UTC

Alison Tan,

We would like to let you know that Essential Studio Weekly NuGet packages (v20.4.0.43) have been published in nuget.org with the fix for the issue “Applied styles do not export properly while exporting the SfDataGrid to Excel”. Please let us know if you have any concerns about this.


Loader.
Live Chat Icon For mobile
Up arrow icon