Skip to main content

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

GridExportCustomizeCellEventArgs.SummaryItem Property

Returns information on the summary calculated in the currently processed cell.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public ExportSummaryItem SummaryItem { get; set; }

#Property Value

Type Description
ExportSummaryItem

An object that contains information on the summary item or null if the processed cell does not belong to a group or total footer.

#Remarks

The CustomizeCell action allows you to customize a cell in the exported file. You can use the AreaType property to determine where the processed cell is placed.

When the AreaType property returns the GroupFooter or TotalFooter value for a currently processed cell, use the SummaryItem property to get information about a summary item contained in this cell.

If the current cell does not belong to a footer row, the SummaryItem property returns null.

razor
<DxGrid @ref="Grid" Data="@Data" ShowGroupPanel="true">
    <Columns>
        <DxGridDataColumn FieldName="OrderDate" GroupIndex="0"/>
        <DxGridDataColumn FieldName="CompanyName" />
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="Quantity" />
        <DxGridDataColumn FieldName="Total" UnboundType="GridUnboundColumnType.Decimal" 
                          UnboundExpression="[UnitPrice]*[Quantity]" DisplayFormat="c" />
    </Columns>
    <GroupSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Sum" FieldName="Total" FooterColumnName="Total" />
    </GroupSummary>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
@code {
    object Data { get; set; }
    IGrid Grid { get; set; }

    async Task ExportXlsx_Click() {
    var options = new GridXlExportOptions();
    options.DocumentCulture = new CultureInfo("en-US");
    options.CustomizeCell = e => {
        // Highlight data cells where Sum > 1000 
        if (e.AreaType == DevExpress.Export.SheetAreaType.GroupFooter && e.SummaryItem.FieldName == "Total" && (decimal)e.Value > 1000) {
            e.Formatting.BackColor = System.Drawing.Color.Pink;
            e.Handled = true;
        }
    };
    await Grid.ExportToXlsxAsync("ExportResult", options);
}
}

Customized summary

See Also