Skip to main content
All docs
V25.1
  • GridDocumentExportSummaryItem.SummaryType Property

    Returns the summary item’s aggregation function.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public GridSummaryItemType SummaryType { get; }

    Property Value

    Type Description
    GridSummaryItemType

    An aggregation function.

    Available values:

    Name Description
    Sum

    Calculates the sum of all values in a column.

    Min

    Calculates the minimum value of all values in a column.

    Max

    Calculates the maximum value of all values in a column.

    Count

    Calculates the number of values in a column.

    Avg

    Calculates the average of all values in a column.

    Custom

    Uses a custom algorithm to calculate a summary value.

    None

    Does not calculates a summary value.

    Remarks

    When exporting Grid data to PDF, handle the CustomizeCell event to customize table cells in the output file. Use the SummaryItems property to obtain information about summaries displayed in the processed cell.

    The following example customizes the text and formatting of summaries in the exported document:

    @rendermode InteractiveServer
    @using DevExpress.Drawing;
    @inject WeatherForecastService ForecastService
    
    <DxGrid @ref="Grid" Data="@forecasts">
        <Columns>
            <DxGridDataColumn Caption="Date" FieldName="Date" ExportWidth="500" />
            <DxGridDataColumn Caption="Temperature (C)" FieldName="TemperatureC" />
            <DxGridDataColumn Caption="Temperature (F)" FieldName="TemperatureF" />
            <DxGridDataColumn Caption="Summary" FieldName="Summary" />
        </Columns>
        <TotalSummary>
            <DxGridSummaryItem SummaryType="GridSummaryItemType.Min" FieldName="Date" />
            <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="Date" />
            <DxGridSummaryItem SummaryType="GridSummaryItemType.Min" FieldName="TemperatureC" />
            <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="TemperatureC" />
        </TotalSummary>
        <ToolbarTemplate>
            <DxToolbar>
                <DxToolbarItem Text="Export to PDF" Click="ExportPdf_Click" BeginGroup="true" />
            </DxToolbar>
        </ToolbarTemplate>
    </DxGrid>
    
    @code {
        IGrid Grid;
        private WeatherForecast[]? forecasts;
    
        protected override async Task OnInitializedAsync() {
            forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
        }
        async Task ExportPdf_Click() {
            await Grid.ExportToPdfAsync("ExportResult", new GridPdfExportOptions() {
                CustomizeCell = OnCustomizeCell,
            });
        }
        void OnCustomizeCell(GridDocumentExportCustomizeCellEventArgs args) {
            if (args.AreaType == DocumentExportAreaType.TotalFooter ) {
                if (args.ColumnFieldName == "Date") {
                    var sum1 = args.SummaryItems[0];
                    var sum2 = args.SummaryItems[1];
                    args.Text = sum1.SummaryType + " " + sum1.FieldName + ": " + sum1.Value;
                    args.Text += "\n" + sum2.SummaryType + " " + sum2.FieldName + ": " + sum2.Value;
                }
                if (args.ColumnFieldName == "TemperatureC") {
                    args.Text = args.SummaryItems[0].Text + "°C\n" + args.SummaryItems[1].Text + "°C";
                    args.ElementStyle.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
                }
            }
            args.Handled = true;
        }
    }
    

    Blazor Grid PDF export - Customize Cells

    See Also