Skip to main content
A newer version of this page is available. .

Custom Export

  • 3 minutes to read

Tip

In v17.2 and higher, we recommend that you use the client API, built-in toolbar, and context menu commands to export ASPxGridView data.

The ASPxGridViewExporter component allows you to export ASPxGridView data to a file or stream in PDF, RTF, CSV, DOCX, XLS, and XLSX formats. You can also use standard toolbar commands, and client-side and server-side API to access the built-in export mechanism.

ASPxGridView-Export-Exporter

Assign ASPxGridView’s ID to the ASPxGridViewExporter.GridViewID property and select the export method. For example, use the ASPxGridExporterBase.WriteXlsToResponse method to export data to a file in XLS format. Refer to the following topic to review a list of available export methods: Member Table: Custom Export.

Use the ASPxGridViewDetailSettings.ExportMode property to specify which detail rows are exported. For example, set this property to Expanded to export only master rows and expanded detail rows.

The ASPxGridViewExporter.Styles property allows you to customize the exported grid’s element appearance.

Important

  • The ASPxGridViewExporter cannot export hidden data columns or template content. The ASPxGridViewExporter identifies grids within GridViewTemplates.DetailRow templates, and allows users to export both master and detail data. Note that templated elements are exported with their default display views. For instance, if you export a grid with templated cells, they are displayed as default labels with text.
  • Add the ASPxGridViewExporter to the page’s controls and recreate it on every round-trip to the server if it’s created dynamically.

Excel Data-Aware Export

The resulting Excel document maintains the following grid data when exporting data in both XLS and XLSX formats:

  • Data grouping - allows users to collapse/expand groups in a worksheet.
  • Data sorting and filtering - allows users to display relevant data in a specific order.
  • Totals and group summaries - allow users to modify/change formulas.
  • Format conditions - allow users to modify/change conditional formatting rules.
  • Data validation for combo-box columns.
  • Fixed columns.

Export Limitations

Data Aware Mode Limitations

You can avoid the specified limitations if you use WYSIWYG (What You See Is What You Get) export mode. However, note that table formatting (for example, grouping) is lost in this mode.

gridExport.WriteXlsxToResponse(new XlsxExportOptionsEx { ExportType = ExportType.WYSIWYG });

Member Table

Task-Based Help