Skip to main content
All docs
V25.2
  • TreeListExportCustomizeCellEventArgs.AreaType Property

    Returns the type of the area where the current cell is placed.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public SheetAreaType AreaType { get; set; }

    Property Value

    Type Description
    DevExpress.Export.SheetAreaType

    The area type.

    Remarks

    The CustomizeCell action allows you to customize a cell in the exported file. The AreaType property identifies the type of the area that contains the processed cell.

    TreeList - Area types

    The AreaType property can return the following values:

    Header
    Identifies a column header. Use the ColumnFieldName property to get the name of the data source field assigned to the column that contains the processed cell.
    DataArea
    Identifies a data row. Use the DataItem property to get the data source item that is bound to the processed row.
    TotalFooter
    Identifies the TreeList footer row. Use the SummaryItem property to get information about the summary item in the processed footer cell.
    @using DevExpress.Export
    
    <DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
    
    <DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId" @ref="MyTreeList">
        <Columns>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
        <TotalSummary>
            <DxTreeListSummaryItem FieldName="Name" SummaryType="TreeListSummaryItemType.Count" />
            <DxTreeListSummaryItem FieldName="DueDate" SummaryType="TreeListSummaryItemType.Min" />
        </TotalSummary>
    </DxTreeList>
    
    @code {
        ITreeList MyTreeList { get; set; }
    
        async Task ExportXlsx_Click() {
            await MyTreeList.ExportToXlsxAsync("ExportResult", new TreeListXlExportOptions() {
                CustomizeCell = OnCustomizeCell
            });
        }
        void OnCustomizeCell(TreeListExportCustomizeCellEventArgs args) {
            if (args.AreaType == SheetAreaType.DataArea) {
                args.Formatting.Font = new XlCellFont() { Italic = true };
                args.Handled = true;
            }
        }
        // ...
    }
    
    See Also