Version

Print or Export a Report

After you create a report, you can print or export the report by calling the Report object’s Print or Export method, respectively. If you are printing or exporting xamDataPresenter™, xamDataGrid™, or xamDataCarousel™, the WPF Reporting engine will automatically paginate the contents of the control and print it in a tabular format.

Printing and Paging

If you want to print or export controls that do not fit on a single page, you have the following three options:

  • IEmbeddedVisualPaginator interface - Create a class that implements this interface and pass a reference to the EmbeddedVisualReportSection object’s constructor.

  • IEmbeddedVisualPaginatorFactory interface - You can implement this interface on a custom control to make the EmbeddedVisualReportSection object use the control’s paging implementation.

  • Scaling - You can horizontally scale your content to fit on a single page by setting the ReportSetting object’s HorizontalPaginationMode property to Scale. However, any content that extends beyond the bottom of the page will not be printed or exported.

The following example code demonstrates how to print or export a report. The example code assumes you already have a Report object named report1.

In Visual Basic:

report1.Print()
'You can uncomment the line below to export the report instead of printing it:
'report1.Export(OutputFormat.XPS, "c:\\Report1.xps")

In C#:

report1.Print();
//You can uncomment the line below to export the report instead of printing it:
//report.Export(OutputFormat.XPS, "c:\\Report1.xps");