Skip to main content
All docs
V25.1
  • TreeListExportOptions.CustomizeCell Property

    Allows you to customize a cell in the exported file.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    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:

    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