Skip to main content

DxGrid.ExportToCsvAsync(Stream, GridCsvExportOptions) Method

Exports grid data to a stream in CSV format.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public Task ExportToCsvAsync(
    Stream stream,
    GridCsvExportOptions options = null
)

Parameters

Name Type Description
stream Stream

The target stream for grid data export.

Optional Parameters

Name Type Default Description
options GridCsvExportOptions null

An object that contains export options.

Returns

Type Description
Task

The task that is completed when the file is exported.

Remarks

Call the ExportToCsvAsync method to export grid data in CSV format. Note that only data cell values are exported - group rows, summaries, and cell style settings are ignored.

The method overloads allow you to write the result to a stream (the current overload) or to a file downloaded to a client machine (ExportToCsvAsync(String, GridCsvExportOptions)). The method accepts a GridCsvExportOptions object as a parameter. You can use this parameter to set up export settings.

Run Demo: Grid - Export

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

Important

Security Considerations

Exported data can contain executable content. To prevent possible security vulnerabilities, set the EncodeExecutableContent property to true to enclose potentially dangerous content in quotation marks prior to exporting it to the CSV format. To learn more, see the property description.

Large Data Limitation

The ExportToCsvAsync method does not work if the grid is bound to a Server Mode data source or to a GridDevExtremeDataSource object.

See Also