aspnet-devexpress-dot-web-be352c28.md
A component that allows you to export the ASPxGridView control’s data.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public class ASPxGridViewExporter :
ASPxGridExporterBase
Public Class ASPxGridViewExporter
Inherits ASPxGridExporterBase
Tip
We recommend that you use the built-in export functionality.
The ASPxGridViewExporter component allows you to export ASPxGridView data to a file or stream in PDF, RTF, CSV, DOCX, XLS, and XLSX formats.
To export grid data, assign the grid control’s ID to the GridViewID property and call an export method.
<dx:ASPxGridView ID="grid" runat="server" DataSourceID="CustomerReportsDataSource" />
<dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="grid" />
ASPxGridViewExporter1.WriteXlsxToResponse();
ASPxGridViewExporter1.WriteXlsxToResponse()
The ASPxGridViewExporter component implements the following export methods:
| Format | Export to a Stream | Export to the Response in Binary Format |
|---|---|---|
| CSV | WriteCsv | WriteCsvToResponse |
| DOCX | WriteDocx | WriteDocxToResponse |
| WritePdf | WritePdfToResponse | |
| RTF | WriteRtf | WriteRtfToResponse |
| XLS | WriteXls | WriteXlsToResponse |
| XLSX | WriteXlsx | WriteXlsxToResponse |
The ASPxGridViewExporter component can export data in XLS and XLSX formats in data-aware mode. This mode maintains the following data shaping settings in the exported document:
You can export grid data in Excel data-aware mode in the following way:
using DevExpress.XtraPrinting;
using DevExpress.Export;
// ...
ASPxGridViewExporter1.WriteXlsxToResponse(new XlsxExportOptionsEx { ExportType = ExportType.DataAware });
Imports DevExpress.XtraPrinting
Imports DevExpress.Export
' ...
ASPxGridViewExporter1.WriteXlsxToResponse(New XlsxExportOptionsEx With {.ExportType = ExportType.DataAware})
ASPxGridViewExporter component to a page and recreate the component on every round-trip to the server.Use the default WYSIWYG export mode to avoid the specified limitations. Note that data shaping settings are lost in this mode.
Object Control ASPxGridExporterBase ASPxGridViewExporter MVCxGridViewExporter
See Also