Skip to main content

GridCsvExportOptions.QuoteStringsWithSeparators Property

Specifies whether a value that contains separators is enclosed in quotation marks.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(true)]
public bool QuoteStringsWithSeparators { get; set; }

Property Value

Type Default Description
Boolean true

true to quote values that include the separator value; otherwise, false.

Remarks

A CSV file stores data in rows where values are delimited with the Separator string. If a value contains a character or character string that matches the separator, you may want to wrap the value into quotation marks to avoid splitting it into multiple parts. Set the QuoteStringsWithSeparators property to true to enclose such values in quotation marks.

The code example below ensures that no value is enclosed in quotation marks:

<DxGrid @ref="Grid"
        Data="@Data">
    <Columns>
        <DxGridSelectionColumn Width="60px" AllowSelectAll="true" />
        <DxGridDataColumn FieldName="ContactName" Width="15%" />
        <DxGridDataColumn FieldName="ContactTitle" Width="15%" />
        <DxGridDataColumn FieldName="CompanyName" Width="20%" />
        <DxGridDataColumn FieldName="Country" Width="15%" GroupIndex="0" />
        <DxGridDataColumn FieldName="FullAddress" UnboundType="GridUnboundColumnType.String" UnboundExpression="[City] + ' - ' + [PostalCode] + ' - ' + [Address]" />
    </Columns>
</DxGrid>

<DxButton Text="Export to CSV" Click="ExportCsv_Click" />

@code {
    IEnumerable<object> Data { get; set; }
    IGrid Grid { get; set; }
    async Task ExportCsv_Click() {
       await Grid.ExportToCsvAsync("ExportResult", new GridCsvExportOptions() {
            QuoteStringsWithSeparators = false
        });
    }
}
See Also