Skip to main content

PivotGridControl.ShowPrintPreview() Method

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

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v23.2.dll

NuGet Package: DevExpress.Win.PivotGrid

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();
});
}
See Also