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

SfDataGrid Export to Excel issue

Thread ID:





140942 Nov 15,2018 09:57 AM UTC Nov 21,2018 12:43 PM UTC WPF 1
Tags: SfDataGrid
Asked On November 16, 2018 10:30 AM UTC

Hello Team Syncfusion,

We are using Syncfusion in our company.We are using version 15.3460.0.29. I'm exporting SfDataGrid to excel by looking at solution given in 

1. But When I export I'm not getting any style such as header color,font color, font style applied as in above example. 
2. There is no formatting in exported excel like rows are aligned randomly. I need to Align middle for all rows. My need is it should look nice with good formatting.
2. Is it possible to make certain columns readonly or locked so that when its exported I shall allow only specific columns to be edited. ?
3.In exported excel, how to freeze Header column while scrollling down through code?
4. Referring to some sample present in SF Knowedge Base, I tried importing data from updated excel(with some changes in some columns) to SfDatagrid. I'm able to load data to SfDatagrid. However when I import excel with grouping done programatically in SFDatagrid, some rows are shown empty. How can I import with grouping toSFDatagrid.

Thanks and regards,

Deivaselvan Y [Syncfusion]
Replied On November 21, 2018 12:43 PM UTC

Hi Vinay,

We have prepared a sample to meet all your requirement. Refer the sample from the below link and let us know if this helps you.


You could follow the below steps to run the attached sample. 
1.       Run the sample application 
2.       Click on "Export To Excel" button - To export the DataGrid to Excel 
3.       Following files will be generated in the output folder 
a.       ExportToExcel.xlsx - Will be reused for importing 
b.       DataGrid.xml - Data Operations of the DataGrid Serialized file and will be reused during importing to retain the grouping again in the DataGrid 
c.       ExportToExcel.xlsm - Will be the resultant Exported excel file which allows the user to expand and collapse the group for the protected sheet while click on the "Enable Content" while opening this file in MS Excel 
4.       Click on the "Clear DataGrid" button to set ItemsSource as null 
5.       Click on the "Import From Excel" button to import the data from the exported excel    sheet with grouping 

Note: To execute the exporting action you should enable the below option in MS Excel From File --> Options. 

Please let us know if you have any other questions.



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

Live Chat Icon For mobile
Live Chat Icon