Back to Devexpress

Printing and Exporting

wpf-8446-controls-and-libraries-pivot-grid-printing-and-exporting.md

latest9.0 KB
Original Source

Printing and Exporting

  • Nov 02, 2023
  • 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.v25.2 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:

MethodDescription
PivotGridControl.ExportToCsvExports the pivot grid to the specified stream or file path in CSV format.
PivotGridControl.ExportToHtmlExports the pivot grid to the specified stream or file path in HTML format.
PivotGridControl.ExportToImageExports the pivot grid to the specified stream or file path in image format.
PivotGridControl.ExportToMhtExports the pivot grid to the specified stream or file path in MHT format.
PivotGridControl.ExportToPdfExports the pivot grid to the specified stream or file path in PDF format.
PivotGridControl.ExportToTextExports the pivot grid to the specified stream or file path in text format.
PivotGridControl.ExportToXlsExports the pivot grid to the specified stream or file path in XLS format.
PivotGridControl.ExportToXlsxExports the pivot grid to the specified stream or file path in XLSX format.
PivotGridControl.ExportToXpsExports 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:

PropertyDescription
PivotGridControl.PrintColumnHeadersGets or sets whether to print headers of the column fields. This is a dependency property.
PivotGridControl.PrintDataHeadersGets or sets whether to print headers of the data fields. This is a dependency property.
PivotGridControl.PrintFilterHeadersGets or sets whether to print headers of the filter fields. This is a dependency property.
PivotGridControl.PrintHeadersOnEveryPageGets 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

Tutorial: Printing and Exporting a Pivot Grid

Export to Tabular Formats (CSV, XLS, XLSX)

Document Post-Processing