Skip to main content

GridExportCustomizeCellEventArgs.AreaType Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.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.

Grid - 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.
GroupHeader
Identifies a group row. Use the GroupFieldName property to get the name of the data source field bound to the processed group column.
DataArea
Identifies a data row. Use the DataItem property to get the data source item that is bound to the processed row.
GroupFooter
Identifies a group footer row. Use the GroupFieldName property to get the name of the data source field bound to the processed group column. The SummaryItem property returns information about the summary item in the processed group footer cell.
TotalFooter
Identifies the grid footer row. Use the SummaryItem property to get information about the summary item in the processed footer cell.
<DxGrid @ref="Grid"
        Data="@Data"
        SelectionMode="GridSelectionMode.Multiple">
    <Columns>
        <DxGridSelectionColumn Width="60px" AllowSelectAll="true" />
        <DxGridDataColumn FieldName="ContactName" Width="15%" />
        <DxGridDataColumn FieldName="ContactTitle" Width="15%" />
        <DxGridDataColumn FieldName="CompanyName" Width="20%" />
        <DxGridDataColumn FieldName="Country" Width="15%" />
        <DxGridDataColumn FieldName="FullAddress" UnboundType="GridUnboundColumnType.String" 
                          UnboundExpression="[City] + ' - ' + [PostalCode] + ' - ' + [Address]" />
    </Columns>
</DxGrid>
@* ... *@
<OptionButton Text="Export to XLS" OnClick="ExportXls_Click" />
@* ... *@
@code {
    IEnumerable<object> Data { get; set; }
    IGrid Grid { get; set; }
    protected override async Task OnInitializedAsync() {
        Data = await NwindDataService.GetCustomersAsync();
    }
    async Task ExportXls_Click() {
       await Grid.ExportToXlsAsync("ExportResult", new GridXlExportOptions() {
            ExportSelectedRowsOnly = true,
            CustomizeCell = OnCustomizeCell
        });
    }
    void OnCustomizeCell (GridExportCustomizeCellEventArgs args) {
        if(args.ColumnFieldName == "ContactName" && args.AreaType == SheetAreaType.DataArea)
            args.Formatting.Font = new XlCellFont() { Italic = true };
        args.Handled = true;
    }
}

Run Demo: Grid - Export Data

See Also