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

Change the value of a cell for export

Thread ID:





119844 Aug 6,2015 11:28 AM UTC Aug 7,2015 06:35 AM UTC WPF 2
Tags: SfDataGrid
Fabio Henrique Baptista
Asked On August 6, 2015 11:28 AM UTC

Hello, how can I manipulate the value of a grid of the cell, to be exported another value.

Ex. Cell the grid is a checkbox (type bool property), export want it to be shown in the spreadsheet cell, 'Y' or 'N'.


Fabio Henrique Baptista
Replied On August 6, 2015 11:30 AM UTC

Sorry, forgot to mention that I am using "grid.ExportToExcel()"

Elavarasan M [Syncfusion]
Replied On August 7, 2015 06:35 AM UTC

Hi Fabio,

Thank you for using Syncfusion products.

We have analysed your query and you can achieve your requirement to manipulate the cell value while exporting the SfDataGrid into excel by using CellsExportingEventHandler which is used to customize the exporting of particular cell value in Excel.
In the CellsExportingEventHandler, you can change the cell value for export based on the column name, cell type and the actual value of the cell like the below code snippet.

Code Snippet:

var options = new ExcelExportingOptions();           

options.CellsExportingEventHandler = cellsExportingHandler;

private void cellsExportingHandler(object sender, GridCellExcelExportingEventArgs e)


    // Based on the column mapping name and the cell type, we can change the cell values when export to excel.

    if(e.CellType == ExportCellType.RecordCell && e.ColumnName == "IsClosed")


        //if the cellvalue is true, "Y" will be displayed and if the value is false, "N" will be displayed when the grid is exported into excel.

        if (e.CellValue.Equals(true))

            e.Range.Cells[0].Value = "Y";


            e.Range.Cells[0].Value = "N";

        e.Handled = true;


Please refer the below UG documentation link to know about the Excel Exporting in SfDataGrid:

UG link: http://help.syncfusion.com/ug/wpf/index.html#!Documents/exporttoexcel.htm

We have prepared the sample based on your requirement and please find the sample from the following location:

Sample: http://www.syncfusion.com/downloads/support/forum/119844/ze/SfDataGrid_Sample1539655632

Please let us know if this solution helps you.

Elavarasan M


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

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