Skip to main content
A newer version of this page is available. .

PivotGridControl.ShowPrintPreview() Method

Opens the Print Preview window with a toolbar-based interface.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v19.1.dll

Declaration

public void ShowPrintPreview()

Remarks

The Preview window displays the pivot grid as it will appear when it is printed. Pivot Grid Control can be previewed and printed if the XtraPrinting Library is available. To ensure that printing and previewing Pivot Grid Control is allowed, use the PivotGridControl.IsPrintingAvailable property.

To open the Print Preview window with a Ribbon-based interface, use the PivotGridControl.ShowRibbonPrintPreview method.

Example

The following example demonstrates how to print the Pivot Grid control using the PivotGridControl.Print method and show its Print Preview window using the PivotGridControl.ShowPrintPreview method.

Note

Printing functionality depends on the DevExpress.XtraPrinting library. To verify that the library is available, use the PivotGridControl.IsPrintingAvailable property.

You can access print settings and modify them using the PivotGridControl.OptionsPrint property.

using DevExpress.XtraPivotGrid;
// ...

private void ShowPivotGridPreview(PivotGridControl pivotGrid) {
    // Verify that the Pivot Grid Control can be printed.
    if (!pivotGrid.IsPrintingAvailable) {
        MessageBox.Show("Missing DevExpress.XtraPrinting library", "Error");
        return;
    }
    pivotGrid.ShowPrintPreview();
}

private void PrintPivotGrid(PivotGridControl pivotGrid) {
    // Verify that the Pivot Grid Control can be printed.
    if (!pivotGrid.IsPrintingAvailable) {
        MessageBox.Show("Missing DevExpress.XtraPrinting library", "Error");
        return;
    }
    pivotGrid.Print();
});
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowPrintPreview() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also