You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to change the default field delimiter when exporting the Grid to CSV file. How to set a different list separator?
26
27
27
28
I want to use a semicolon field delimiter for the exported CSV Grid instead of comma. How to achieve this?
28
29
29
-
>tip At the time of writing (**UI for Blazor 3.5.0**), the Blazor Grid [does not expose a built-in option for configuring the field delimiter](https://feedback.telerik.com/blazor/1577167-option-to-configure-the-field-delimiter-when-exporting-to-csv). You may vote for the enhancement and follow it to receive status updates.
30
+
>tip The Blazor Grid [does not expose a built-in option for setting the CSV delimiter](https://feedback.telerik.com/blazor/1577167-option-to-configure-the-field-delimiter-when-exporting-to-csv). You can vote for the enhancement and follow it to receive status updates. It depends on a [feature of RadSpreadProcessing](https://feedback.telerik.com/document-processing/1356286-spreadstreamprocessing-implement-settings-for-changing-the-delimiter-and-quote-when-exporting-to-csv).
30
31
31
32
## Solution
32
33
33
-
A possible option is to manually modify the exported CSV file before it reaches the client to change the field delimiter.
34
+
Modify the exported CSV file before it reaches the user to change the field delimiter.
34
35
35
-
For that purpose use the [`RadSpreadProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview) library - it allows you to create spreadsheets from scratch, modify existing documents or convert between the most common spreadsheet formats. In this case, we will focus on the [`CsvFormatProvider` which exposes setting to configure the field delimiter](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/csv/settings).
36
+
Use the [`RadSpreadProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview) library. It allows you to create spreadsheets from scratch, modify existing documents or convert between the most common spreadsheet formats. In this case, we will focus on the [`CsvFormatProvider` which exposes setting to configure the field delimiter](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/csv/settings).
36
37
37
-
To change the CSV value delimiter, do the following:
38
+
To change the CSV value delimiter:
38
39
39
40
1. Install the `Telerik.Documents.Spreadsheet.FormatProviders.Xls` NuGet package, so you can use the `CsvFormatProvider`.
40
41
1. Handle the [Grid `OnAfterExport` event](slug:grid-export-events#onafterexport). The `Stream` it provides is finalized, so that the resource does not leak. Its binary data, however, is available, so you can copy the stream bytes to a new `MemoryStream` instance.
@@ -94,7 +95,7 @@ To change the CSV value delimiter, do the following:
94
95
//Import the stream to a Telerik Workbook
95
96
Workbook workbook = formatProvider.Import(importCsvStream, new TimeSpan(0, 0, 5));
96
97
97
-
//Create a new MemoryStream to export the modified Workbook
98
+
//Create a new MemoryStream to export the modified Workbook.
98
99
using MemoryStream exportCsvStream = new MemoryStream();
99
100
100
101
//Set the desired new CSV delimiter.
@@ -138,7 +139,6 @@ To change the CSV value delimiter, do the following:
138
139
139
140
## See Also
140
141
141
-
*[Format numbers and dates in the exported CSV file from the Grid](slug:grid-kb-number-formatting-of-the-csv-export)
142
-
*[Custom cell formatting of the exported file with RadSpreadProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadprocessing)
0 commit comments