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

GridXlExportOptions.SuppressEmptyStrings Property

Specifies whether the grid export empty strings as blank cells in Excel formats.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(false)]
public bool SuppressEmptyStrings { get; set; }

#Property Value

Type Default Description
Boolean false

true to export empty strings as blank cells; false to export empty strings as empty string values.

#Remarks

In XLS and XLSX file formats, empty cell values can be displayed as empty strings or as blank (null) cells.

The grid exports empty strings in XLS and XLSX formats as non blank values and the ISBLANK Microsoft Excel function for these cells returns false. Set the SuppressEmptyStrings property to true to export empty strings as null values. In this case, the ISBLANK function for these cells returns true.

razor
<DxGrid @ref="Grid" Data="@Data" >
    <Columns>
        <DxGridDataColumn FieldName="ContactName" />
        <DxGridDataColumn FieldName="ContactTitle" />
        <DxGridDataColumn FieldName="CompanyName" />
        <DxGridDataColumn FieldName="Country" />
    </Columns>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />

@code {
    IEnumerable<object> Data { get; set; }
    IGrid Grid { get; set; }
    protected override async Task OnInitializedAsync() {
        Data = await NwindDataService.GetCustomersAsync();
    }
    async Task ExportXlsx_Click() {
       await Grid.ExportToXlsxAsync("ExportResult", new GridXlExportOptions() {
            SuppressEmptyStrings = true,
        });
    }
}
See Also