XlsxExportOptionsEx.CustomizeCell Event

Allows you to customize a cell in the output document. Only available in data-aware export mode.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v21.1.Core.dll


public event CustomizeCellEventHandler CustomizeCell


To learn about the functionality provided by this event, see XlsExportOptionsEx.CustomizeCell.


This example uses the XlsxExportOptionsEx.CustomizeCell event to replace values in the Discontinued column in an XLSX document (a result of data exporting from a Grid Control) with special symbols. The ColumnName event parameter allows recognizing the desired column. The Value parameter is utilized to substitute certain cell values. The Handled parameter is set to true to apply the changes made.


// Specify the value alignment for Discontinued field.
XlCellAlignment aligmentForDiscontinuedColumn = new XlCellAlignment() {
    HorizontalAlignment = XlHorizontalAlignment.Center,
    VerticalAlignment = XlVerticalAlignment.Center

void options_CustomizeCell(CustomizeCellEventArgs e){
    // Substitute Boolean values within the Discontinued column by special symbols.
    if(e.ColumnFieldName == "Discontinued"){
        if(e.Value is bool){
            e.Handled = true;
            e.Formatting.Alignment = aligmentForDiscontinuedColumn;
            e.Value = ((bool) e.Value) ? "☑" : "☐";


The following example exports data from a GridControl to XLS format. The XlsExportOptionsEx.CustomizeCell event is used to change the background of the grid control’s City column in the output document, and to provide hyperlinks for this column’s cells. Note that the Handled event parameter is set to true to apply the changes made.


using DevExpress.XtraPrinting;

// Ensure that the data-aware export mode is enabled.
DevExpress.Export.ExportSettings.DefaultExportType = DevExpress.Export.ExportType.DataAware;

private void button1_Click(object sender, EventArgs e) {
    string file = "c:\\work\\grid-export.xls";
    XlsExportOptionsEx op = new XlsExportOptionsEx();
    op.CustomizeCell += op_CustomizeCell;
    gridView1.ExportToXls(file, op);

void op_CustomizeCell(DevExpress.Export.CustomizeCellEventArgs ea) {
    if (ea.ColumnFieldName == "City") {
        ea.Hyperlink = "https://www.google.com/search?q=" + ea.Value.ToString();
        ea.Formatting.BackColor = Color.Pink;
        ea.Handled = true;
See Also