Skip to main content
All docs
V25.1
  • GridXlExportOptions.SuppressEmptyStrings Property

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

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [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.

    <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