Data-Aware Export

  • 3 minutes to read

The data-aware export is the default export mode for the XLS, XLSX, and CSV formats. This mode allows you to transfer data shaping operations (filters, groups, conditional formatting, etc.) into a document. The data-aware mode provides improved performance and memory usage compared to WYSIWYG mode.


The CardView does not support the data-aware export.

Supported Data Shaping Features

The data-aware export mode retains the following grid data shaping features in the exported documents:

Export Data

The following code sample exports the GridControl to the Xls file:

void Button_Click_Export(object sender, RoutedEventArgs e) {

The following methods export GridControl data in the data-aware mode:

Method Description
TableView.ExportToCsv, TreeListView.ExportToCsv Exports a grid to the specified stream in CSV format.
TableView.ExportToXls, TreeListView.ExportToXls Exports a grid to the specified file path in XLS format.
TableView.ExportToXlsx, TreeListView.ExportToXlsx Exports a grid to the specified stream in XLSX format.

Customize Appearance


The exported GridControl ignores the DataViewBase.CellTemplate and regular Template/Style properties. Refer to the Format Cell Values topic for information on what properties affect the data-aware export mode.

The following code sample changes the Birthday column's width and the background color of odd rows in the exported document:

void Button_Click_Export(object sender, RoutedEventArgs e) {
    XlsExportOptionsEx options = new XlsExportOptionsEx();
    options.CustomizeCell += Options_CustomizeCell;
    options.CustomizeDocumentColumn += Options_CustomizeDocumentColumn;
    view.ExportToXls(@"c:\Example\grid_export.xls", options);
void Options_CustomizeCell(CustomizeCellEventArgs e) {
    if (e.DocumentRow % 2 != 0)
        e.Formatting.BackColor = System.Drawing.Color.PeachPuff;
    e.Handled = true;
void Options_CustomizeDocumentColumn(CustomizeDocumentColumnEventArgs e) {
    if (e.ColumnFieldName == "Birthday")
        e.DocumentColumn.WidthInPixels = 300;

To customize the resulting document in the data-aware export mode, use members of the XlsxExportOptionsEx, XlsExportOptionsEx, or CsvExportOptionsEx classes.

Event Description
XlsxExportOptionsEx.CustomizeCell, XlsExportOptionsEx.CustomizeCell, CsvExportOptionsEx.CustomizeCell Allows you to customize a cell in the output document.
XlsxExportOptionsEx.CustomizeDocumentColumn, XlsExportOptionsEx.CustomizeDocumentColumn Allows you to customize an individual column in the output document (for example, change its width, formatting, collapse the group containing the column or hide the column).
XlsxExportOptionsEx.CustomizeSheetFooter, XlsExportOptionsEx.CustomizeSheetFooter Allows you to add a footer to the output document.
XlsxExportOptionsEx.CustomizeSheetHeader, XlsExportOptionsEx.CustomizeSheetHeader Allows you to add a header to the output document.
XlsxExportOptionsEx.CustomizeSheetSettings, XlsExportOptionsEx.CustomizeSheetSettings Allows you to customize the output document's settings.


  • If the GridControl works in the master-detail mode, only master rows are exported.
  • Printing styles and templates are not supported.
  • Custom summary export is not supported.
  • Icon Sets that are used for conditional formatting are not supported.
  • If you applied a conditional formatting filter, the Data-aware Export discards all the conditional formats applied to the GridControl except the FormatCondition conditional formats.
  • In-place ImageEditSettings are not exported.
  • Custom masks are not exported.

Refer to the Excel Export Specifications and Limits topic for more information.