The following example demonstrates the use of the ReportPrinter class. The example assumes that report1 is a variable identifying a valid Report instance and that the Run method of this instance has already been invoked.
C# Copy Code |
---|
ReportPrinter printer = new ReportPrinter(); |
Visual Basic Copy Code |
---|
Dim printer As New ReportPrinter() |
To preview the report, create a ReportPrinter object and assign the report to its Report property in a way similar to the one specified above. Instead of calling the Print method however, create an instance of the .NET PrintPreviewDialog class, assign the previously created ReportPrinter object to its Document property and call its Show or ShowDialog method.
The following example demonstrates how to preview an existing report. The example makes the same assumptions as the one above.
C# Copy Code |
---|
ReportPrinter printer = new ReportPrinter(); |
Visual Basic Copy Code |
---|
Dim printer As New ReportPrinter() |
MindFusion.Reporting supplies a custom print preview form. This form contains better looking toolbar icons but its functionality is similar to the standard PrintPreviewDialog. The extended preview form is exposed by the PrintPreviewForm class, found in the MindFusion.Reporting.WinForms.dll. The extended form is used the same way as the standard .NET PrintPreviewDialog - you assign the ReportPrinter object to its Document property and call either Show or ShowDialog methods.
The following image shows the extended preview form displaying a report:
The extended preview form can be customized through the options argument supplied to its overloaded constructor. This argument is of type PreviewOptions and provide several properties that allow you to customize various aspect of the form, such as the tooltips of the toolbar buttons.