Skip to main content
All docs
V25.1
  • GridExportOptions.ExportDisplayText Property

    Indicates whether the Grid exports cell values in the same format they are presented in the grid.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

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

    Property Value

    Type Default Description
    Boolean false

    true to export cell display texts; false to export cell values.

    Remarks

    When exporting data in CSV, XLS or XLSX format, the grid exports cell values. Set the ExportDisplayText property to true to export display text instead of values. This scenario can be useful when you specify custom display text for cells (see the DisplayFormat property and CustomizeCellDisplayText event descriptions).

    <DxGrid @ref="Grid" Data="@Data" CustomizeCellDisplayText="Grid_CustomizeCellDisplayText" PageSize="7">
        <Columns>
            <DxGridDataColumn FieldName="Date" DisplayFormat="D" />
            <DxGridDataColumn FieldName="CloudCover" />
            <DxGridDataColumn FieldName="TemperatureC" TextAlignment="GridTextAlignment.Left" 
                              Caption="Forecast" FilterMode="GridColumnFilterMode.Value" />
        </Columns>
    </DxGrid>
    <DxButton Text="Export Values to XLSX" Click="ExportXlsx_Values" />
    <DxButton Text="Export Texts to XLSX" Click="ExportXlsx_DisplayText" />
    @code {
        object Data { get; set; }
        IGrid Grid { get; set; }
        protected override void OnInitialized() {
            Data = ForecastService.GetForecast().ToList();
        }
        void Grid_CustomizeCellDisplayText(GridCustomizeCellDisplayTextEventArgs e) {
            if(e.FieldName == "TemperatureC") {
                int val = Convert.ToInt32(e.Value);
                if(val < 15)
                    e.DisplayText = "Cold";
                else if(val < 25)
                    e.DisplayText = "Warm";
                else 
                    e.DisplayText = "Hot";
            }
        }
        async Task ExportXlsx_Values() {
            var options = new GridXlExportOptions();
            await Grid.ExportToXlsxAsync("ExportResult_Values", options);
        }
        async Task ExportXlsx_DisplayText() {
            var options = new GridXlExportOptions();
            options.ExportDisplayText = true;
            await Grid.ExportToXlsxAsync("ExportResult_DisplayText", options);
        }
    }
    

    Grid with Custom Cell Display Text

    ExportResult_Values.xlsx

    Exported data values

    ExportResult_DisplayText.xlsx

    Exported data display texts

    For more information about data export in the Grid component, refer to the following topic: Export Data in Blazor Grid.

    View Example: Customize Export Settings

    See Also