Skip to main content

GridCsvExportOptions.Separator Property

Specifies a character sequence that separates values in the exported CSV file.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public string Separator { get; set; }

Property Value

Type Description
String

Any character or character sequence.

Remarks

CSV is a text format that stores data in rows where values are delimited by a separator. When you export Grid content, the default separator is a comma (,). If the comma is used as a decimal separator in the current culture, the default separator is a semicolon (;).

Use the Separator property to change the default separator.

The following code snippet uses a semicolon as a value separator:

<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="1" />
        <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() {
            Separator = ";"
        });
    }
}

You can use the QuoteStringsWithSeparators property to enclose values in quotation marks if they contain the same character or character sequence as a separator.

See Also