Back to Devexpress

DashboardViewer.PrintPreviewShowing Event

dashboard-devexpress-dot-dashboardwin-dot-dashboardviewer-b898c36a.md

latest4.6 KB
Original Source

DashboardViewer.PrintPreviewShowing Event

Allows you to customize the Print Preview window at runtime.

Namespace : DevExpress.DashboardWin

Assembly : DevExpress.Dashboard.v25.2.Win.dll

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public event PrintPreviewShowingEventHandler PrintPreviewShowing
vb
Public Event PrintPreviewShowing As PrintPreviewShowingEventHandler

Event Data

The PrintPreviewShowing event's data class is PrintPreviewShowingEventArgs. The following properties provide information specific to this event:

PropertyDescription
RibbonPreviewGets the Print Preview with a ribbon toolbar.
StandardPreviewGets the Print Preview with a standard toolbar.

Remarks

The PrintPreviewShowing event is raised before the Print Preview window is invoked, and allows you to customize the Print Preview window and the displayed document.

The Print Preview window provides two toolbar types and can be invoked in two ways.

The following event parameters allow you to customize the Print Preview depending in the used toolbar.

Important

Note that you can customize the exported document by handling the DashboardViewer.CustomExport event.

Example

The code snippet below shows how to access the underlying report when handling the DashboardViewer.PrintPreviewShowing event.

csharp
using DevExpress.DashboardWin;

        // ...
        private void dashboardViewer1_PrintPreviewShowing(object sender, PrintPreviewShowingEventArgs e) {
            PrintingSystemBase ps = e.RibbonPreview.PrintControl.PrintingSystem;
            ps.SetCommandVisibility(PrintingSystemCommand.ExportXlsx, CommandVisibility.All);
            ps.SetCommandVisibility(PrintingSystemCommand.SendXlsx, CommandVisibility.All);

            ps.SetCommandVisibility(PrintingSystemCommand.Save, CommandVisibility.None);
            ps.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None);
        }
vb
Imports DevExpress.DashboardWin

        ' ...
        Private Sub dashboardViewer1_PrintPreviewShowing(ByVal sender As Object, ByVal e As PrintPreviewShowingEventArgs)
            Dim ps As PrintingSystemBase = e.RibbonPreview.PrintControl.PrintingSystem
            ps.SetCommandVisibility(PrintingSystemCommand.ExportXlsx, CommandVisibility.All)
            ps.SetCommandVisibility(PrintingSystemCommand.SendXlsx, CommandVisibility.All)

            ps.SetCommandVisibility(PrintingSystemCommand.Save, CommandVisibility.None)
            ps.SetCommandVisibility(PrintingSystemCommand.Open, CommandVisibility.None)
        End Sub

Implements

PrintPreviewShowing

See Also

DashboardViewer Class

DashboardViewer Members

DevExpress.DashboardWin Namespace