Skip to main content
All docs
V25.1
  • GridExportCustomizeCellEventArgs.SummaryItem Property

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

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    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.

    <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