Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeListExportOptions.CustomizeCell Property

Allows you to customize a cell in the exported file.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public Action<TreeListExportCustomizeCellEventArgs> CustomizeCell { get; set; }

#Property Value

Type Description
Action<TreeListExportCustomizeCellEventArgs>

A delegate method that customize the cell.

#Remarks

The CustomizeCell action allows you to perform the following actions:

Set the Handled property to true to apply the specified settings. Otherwise, the cell is exported with the default settings. The GetRowValue(String) method returns the value of the specified data field in the current row.

The table below lists properties that you can use to get additional information about the processed cell depending on the processed area type (AreaType).

Area Type Related Properties Properties That Return null
Header ColumnFieldName DataItem, SummaryItem
DataArea ColumnFieldName, DataItem SummaryItem
TotalFooter ColumnFieldName, SummaryItem DataItem

Run Demo: TreeList - Export Data

The following example colors exported data cells light yellow:

C#
async Task ExportXlsx_Click() {
    await MyTreeList.ExportToXlsxAsync("ExportResult", new TreeListXlExportOptions() {
        CustomizeCell = CustomizeCell
    });
}
void CustomizeCell(TreeListExportCustomizeCellEventArgs e) {
    if (e.AreaType == DevExpress.Export.SheetAreaType.DataArea) {
        e.Formatting.BackColor = System.Drawing.Color.LightYellow;
    }
    // Set the Handled property to true to apply the specified settings
    e.Handled = true;
}

For more information about data export in the TreeList component, refer to the following topic: Export Data in Blazor TreeList.

See Also