Export Modes
- 2 minutes to read
The ASPxGridView control can export data in DataAware
and WYSIWYG
(What You See Is What You Get) modes.
You can specify the export mode at design time (using the ExcelExportMode property) or send the ExportType
parameter to an export method at runtime.
<dx:ASPxGridView ID="grid" runat="server" DataSourceID="CategoriesDataSource" KeyFieldName="CategoryID">
<SettingsExport ExcelExportMode="WYSIWYG" />
<%--...--%>
DataAware Mode
Supported formats: XLS and XLSX.
This mode maintains the following data shaping settings in the exported document:
- Data grouping
- Data sorting and filtering
- Totals and group summaries
- Format conditions
- Data validation for combo-box columns
- Fixed columns
API to Customize the Exported Grid Elements
Limitations
- The ASPxGridView control does not export HTML tags in data cells. Handle the XlsExportOptionsEx.CustomizeCell or XlsxExportOptionsEx.CustomizeCell event to add HTML tags to exported documents.
- Images rendered in an GridViewDataImageColumn are not exported. Handle the ExportRenderBrick event to implement image export.
- Template content is not exported (including master-detail grids and preview rows). During export operations, the Grid replaces templated elements with their default representations. For instance, templated cells are exported as labels with text.
Unsupported API
- ReportHeader/ReportFooter
- PageHeader/PageFooter
- The ExportRenderBrick event does not fire. Use the XlsExportOptionsEx.CustomizeCell or XlsxExportOptionsEx.CustomizeCell event instead.
- The StylesExport property has no effect. Specify the ExportCellStyle property at the column level or handle the XlsExportOptionsEx.CustomizeCell/XlsxExportOptionsEx.CustomizeCell event instead.
WYSIWYG Mode
Supported formats: PDF, RTF, CSV, XLS, XLSX, and DOCX.
This mode exports GridView data as plain text. The table formatting (such as grouping) is lost and summaries are converted to strings.
API to Customize the Exported Grid Elements
Limitations
- The ASPxGridView control does not export HTML tags in data cells. Handle the ExportRenderBrick event to add HTML tags to exported documents.
- Images rendered in the GridViewDataImageColumn column are not exported. Handle the ExportRenderBrick event to implement image export.
- Template content is not exported (except for the detail grid in the DetailRow template). Templated elements are exported with their default representation. For instance, templated cells are exported as labels with text.
- Rich text formatting is ignored in ReportHeader and ReportFooter property values.