Skip to main content

Printing and Exporting

  • 3 minutes to read

Printing and Exporting Basics

The Pivot Grid control provides a fast and flexible way to bring its contents to the printed page, or export to a file or stream in various formats - PDF, RTF, XLS, etc. You must manually add the reference to the DevExpress.Xpf.Printing.v24.1 assembly. Otherwise, data printing and exporting are not allowed.

Run Demo: Print Templates

Run Demo: Print Options

To preview the pivot grid, use the following members:

The Print Preview window allows you to customize the printed document, print it or export to a file in the required format.

The following table lists methods allowing you to export data:

Method Description
PivotGridControl.ExportToCsv Exports the pivot grid to the specified stream or file path in CSV format.
PivotGridControl.ExportToHtml Exports the pivot grid to the specified stream or file path in HTML format.
PivotGridControl.ExportToImage Exports the pivot grid to the specified stream or file path in image format.
PivotGridControl.ExportToMht Exports the pivot grid to the specified stream or file path in MHT format.
PivotGridControl.ExportToPdf Exports the pivot grid to the specified stream or file path in PDF format.
PivotGridControl.ExportToText Exports the pivot grid to the specified stream or file path in text format.
PivotGridControl.ExportToXls Exports the pivot grid to the specified stream or file path in XLS format.
PivotGridControl.ExportToXlsx Exports the pivot grid to the specified stream or file path in XLSX format.
PivotGridControl.ExportToXps Exports the pivot grid to the specified stream or file path in XPS format.

Data Aware Export

When exporting to tabular formats (CSV, XLS, XLSX), the export engine uses the Excel Export Library to perform a Data-Aware export with improved performance and reduced memory usage. The resultant file is optimized for subsequent analysis in Microsoft Excel. For more information, refer to the Export to Tabular Formats (CSV, XLS, XLSX) document.

Printing Options and Settings

The DXPivotGrid provides multiple options, styles and templates, that allow you to customize the printed document.

The following table lists printing options:

Property Description
PivotGridControl.PrintColumnHeaders Gets or sets whether to print headers of the column fields. This is a dependency property.
PivotGridControl.PrintDataHeaders Gets or sets whether to print headers of the data fields. This is a dependency property.
PivotGridControl.PrintFilterHeaders Gets or sets whether to print headers of the filter fields. This is a dependency property.
PivotGridControl.PrintHeadersOnEveryPage Gets or sets whether to print field headers on every page. This is a dependency property.
PivotGridControl.PrintHorzLines

Gets or sets whether the horizontal grid lines are printed. This is a dependency property.

PivotGridControl.PrintInsertPageBreaks Gets or sets whether to insert page breaks at the end of every page. This is a dependency property.
PivotGridControl.PrintLayoutMode Gets or sets the layout mode of the print document. This is a dependency property.
PivotGridControl.PrintRowHeaders Gets or sets whether to print headers of the row fields. This is a dependency property.
PivotGridControl.PrintUnusedFilterFields Gets or sets whether to print headers of the unused filter fields. This is a dependency property.
PivotGridControl.PrintVertLines

Gets or sets whether the vertical grid lines are printed. This is a dependency property.

The following table lists the templates applied to DXPivotGrid elements when they are printed.

Property

Description

PivotGridControl.PrintFieldCellTemplate

PivotGridControl.PrintFieldCellTemplateSelector

PivotGridControl.PrintFieldCellKpiTemplate

PivotGridControl.PrintFieldCellKpiTemplateSelector

PivotGridField.PrintCellTemplate

PivotGridField.PrintCellTemplateSelector

Specify the template that defines the presentation of the data cells when the pivot grid is printed.

PivotGridControl.PrintFieldHeaderTemplate

PivotGridControl.PrintFieldHeaderTemplateSelector

PivotGridField.PrintHeaderTemplate

PivotGridField.PrintHeaderTemplateSelector

Specify the template that defines the presentation of the field headers when the pivot grid is printed.

PivotGridControl.PrintFieldValueTemplate

PivotGridControl.PrintFieldValueTemplateSelector

PivotGridField.PrintValueTemplate

PivotGridField.PrintValueTemplateSelector

Specify the template that defines the presentation of the field values when the pivot grid is printed.

See Also