The following example demonstrates a workaround that allows you to print and export a dashboard via the Print Preview.
In this example, the Customer Support dashboard is displayed. You can invoke the Print Preview for the dashboard in one of the two modes, using the Show Preview or Show Paged Preview button. In the first mode, the paper size is adjusted to fit the dashboard. In the second mode, the dashboard gets split across the appropriate number of standard A4 pages.
To accomplish this, we have created a DashboardExporter class that implements the DevExpress.XtraPrinting.IPrintable interface. DashboardExporter instances are mapped to a DashboardViewer when they are created and then passed to the Print Preview thus bringing the dashboard to paper.
Example Comments
Added By: S Broskie at: 2/12/2013 9:40:51 AM
I appreciate the sample. I did have one question related to the size. If I squeeze the form down, which reduces the dashboard size and then do a print preview, the sides get chopped off. What would be the best way to keep the preview and export at a consistent size without having to worry about a user shrinking the form and therefore shrinking the output? Clone the dashboard somehow and actually do the export on that internally sized clone? If so, could you augment the sample to try and export a consistent size no matter what shape the form and dashboard are in?
Thanks!
Added By: Boris Soto at: 3/12/2013 11:34:23 PMI used this code in a new dashboard viewer, how do I tell the button to print the dashboard and what about if I have multiple dashboard