Version

Show a Print Preview

You can use the xamReportPreview™ control to display a print preview of a report to your end users. There are four steps required to display a print preview:

  1. Add WPF Reporting to Your Page and Create a Report.

  2. Pass the Report object to the Window that is hosting the xamReportPreview control.

This topic does not discuss the implementation details on passing a Report object to a Window that is hosting the xamReportPreview control.

  1. Call xamReportPreview’s GeneratePreview method and pass in a Report object as a parameter.

The two Boolean parameters determine if your end users will see a print dialog and a progress bar when you generate a preview.

The following example code demonstrates how to show a print preview. The example code assumes you already have a Report object name report1 and a xamReportPreview control named xamReportPreview1.

In Visual Basic:

'A print dialog will not be shown to the end user; however, a progress bar will be shown to the end user.
xamReportPreview1.GeneratePreview(report1, False, True)

In C#:

//A print dialog will not be shown to the end user; however, a progress bar will be shown to the end user.
xamReportPreview1.GeneratePreview(report1, false, true);