Skip to main content

GridXlExportOptions.CountBlankCellsInSummary Property

Specifies whether the Count summary function takes blank cells into account when exporting data in Excel formats.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(false)]
public bool CountBlankCellsInSummary { get; set; }

Property Value

Type Default Description
Boolean false

true, to count non-blank and blank cells; false to count non-blank cells only.

Remarks

The Count summary function in the source Grid component calculates the number of data rows (regardless of whether or not row values are empty).

When you export the summary to XLS or XLSX, the Count function in Excel calculates the number of non-blank cells only.

Grid - Blank cells are not counted

Set the CountBlankCellsInSummary property to true to take blank and non-blank cells into account in the resulting document.

<DxGrid @ref="Grid" Data="@Data" PageSize="5" >
    <Columns>
        <DxGridDataColumn FieldName="CompanyName" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="Region" />
        <DxGridDataColumn FieldName="Country" />
    </Columns>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Region" />
    </TotalSummary>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
@code {
    object Data { get; set; }
    IGrid Grid { get; set; }
    protected override async Task OnInitializedAsync() {
    var invoices = await NwindDataService.GetInvoicesAsync();
    var customers = await NwindDataService.GetCustomersAsync();
    Data = invoices.OrderBy(i => i.OrderDate).Join(customers, i => i.CustomerId, c => c.CustomerId, (i, c) => {
        return new {
            CompanyName = c.CompanyName,
            City = i.City,
            Region = i.Region,
            Country = i.Country,
            UnitPrice = i.UnitPrice,
            Quantity = i.Quantity
        };
    });
    }
    async Task ExportXlsx_Click() {
        var options = new GridXlExportOptions();
        options.CountBlankCellsInSummary = true;
       await Grid.ExportToXlsxAsync("ExportResult", options);
    }
}

Grid - Blank cells are counted

See Also