[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Selection
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Drag-and-Drop
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Collapse]Printing and Exporting
     Printing
     Printing Options
     Exporting
     Customizing the Appearance of Data Cells when Printing or Exporting the Grid
     Grid-Based Report Generation
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Exporting

The GridControl provides a fast and flexible way to export its data to a file or stream in various formats. This topic consists of the following sections:

Expanded Overview

A View provides multiple methods to export its contents.

Method Description
DataViewBase.ExportToHtml Exports a grid to the specified file path in HTML format.
DataViewBase.ExportToImage Exports a grid to the specified file path in image format.
DataViewBase.ExportToMht Exports a grid to the specified file path in MHT format
DataViewBase.ExportToPdf Exports a grid to the specified file path in PDF format.
DataViewBase.ExportToRtf Exports a grid to the specified stream in RTF format.
DataViewBase.ExportToText Exports a grid to the specified stream in text format.
DataViewBase.ExportToXps Exports a grid to the specified file path in XPS format.
TableView.ExportToCsv, TreeListView.ExportToCsv, CardView.ExportToCsv Exports a grid to the specified stream in CSV format.
TableView.ExportToXls, TreeListView.ExportToXls, CardView.ExportToXls Exports a grid to the specified file path in XLS format.
TableView.ExportToXlsx, TreeListView.ExportToXlsx, CardView.ExportToXlsx Exports a grid to the specified stream in XLSX format.

The Print Preview window allows you to customize the printed document, print or export it to a file in the required format. The image below illustrates the Print Preview window for a sample grid.

See the Printing Options section of the Printing topic to learn how to specify the View elements to be printed.

Expanded Export to XLS, XLSX, and CSV Formats

The GridControl supports two export modes when exporting data to XLS, XLSX, and CSV formats:

Data-aware Export

This is the default export mode, optimized for subsequent analysis of grid data within Microsoft Excel. Output documents retain various data shaping options that are applied within the grid. The data-aware export functionality provides improved performance and memory usage.

Note

Currently CardView does not support the data-aware export.

The GridControl supports the following features for all Excel export operations:

The data-aware export has the following limitations:

  • Only master rows are shown when exporting master-detail data.
  • Printing styles and templates are not supported.
  • Custom summary export is not supported.
  • Icon Sets that are used for conditional formatting are not supported.

WYSIWYG Export

In this export mode, resulting documents retain the layout of grid cells. Specific data shaping options are not retained, in comparison to the data-aware export.

Set the ExportSettings.DefaultExportType property to ExportType.WYSIWYG to enable the WYSIWYG export mode in an application.

The following code illustrates the WYSIWYG export to XLSX:

Expanded See Also

Is this topic helpful?​​​​​​​