Udostępnij za pośrednictwem


Printing Reports from ReportViewer

At run time, application users can use the print commands on the ReportViewer toolbar to open a Print dialog box, preview the report in print layout, and configure page setup prior to printing.

Print support varies depending on whether you are using the Web server control or Windows Forms control, and whether the control is configured for local or remote processing.

  • The ReportViewer Windows Forms control always uses the print functionality of the client operating system. Clicking the Print icon on the report toolbar opens the common Print dialog box, initialized with the printers configured on the client computer.

  • The ReportViewer Web server control, when used with server reports, provides an ActiveX print control that you can use instead of browser print functionality. In contrast with browser print functionality, the print control allows you to print all of the pages of a paginated report, without the page information that some browsers add to the printout. Depending on browser settings, you might need to download and configure the control.

  • The ReportViewer Web server control, when used with client report definition (.rdlc) files, does not provide built-in print support. Although you can use the browser print functionality, you might achieve better results if you export the report to PDF or Excel and then print from the PDF viewer or Excel.

To learn how to print reports programmatically, see Walkthrough: Printing a Local Report without Preview.

Previewing a Report and Setting Page Sizes

The ReportViewer toolbar in the Windows Forms control includes commands for viewing a report in print layout and setting page sizes. When you click Print Layout, the ReportViewer toolbar is updated to show just the commands that you can use during preview. Print Layout is a toggle command. You can switch between preview and report session by clicking this button. When you click Page Size, you can specify page dimensions that are used only for print output. The page dimensions are initialized with values from the report definition, but you can override the values for printing purposes. You cannot save the values with the report.

The Web server control supports the same preview and page size functionality, but it is provided through the print control rather than as separate commands on the toolbar.

Configuring the Print Control for Server Reports Using the ReportViewer Web Server Control

The ReportViewer Web server control provides an ActiveX print control for server reports that are processed on a remote SQL Server 2005 Reporting Services report server. This control downloads automatically the first time the Print command on the ReportViewer toolbar is clicked, and is installed on the client computer. If the user does not install the control, or if support for the print control is disabled on the report server, the Print command cannot be used. After the control is installed, users can use the print control to print server reports configured to run in the ReportViewer Web server control.

Depending on browser settings, each user might need to configure the browser to enable an ActiveX control download. To configure Internet Explorer to allow ActiveX control downloads, follow these steps:

  1. In Microsoft Internet Explorer, from the Tools menu, choose Internet Options, and then click the Security tab.

  2. Select the Trusted sites Web content zone, and then click Sites.

  3. Type the report server URL. By default, this is https://<ComputerName>/reportserver if you are using Secure Sockets Layer (SSL).

  4. Click Add, and then click OK.

  5. Click the Custom Level button. Scroll to the ActiveX controls and plug-ins node.

  6. Click Enable for Download signed ActiveX controls, and then click OK.

See Also

Concepts

Configuring and Using the ReportViewer Toolbar
Defining Page Size and Page Breaks in a Report (Visual Studio Report Designer)