Printing a Report

To print a report, there is a simple PrintReport method that will invoke a standard Windows printer to select where you would like to print your report, how many copies, and other functions.

To add this code to your custom viewer, drag and drop a button onto your form, and name it Print_Button. Change the Text property to Print. Double-click the Print button you have dropped onto your form and enter the following code in its Click event:

CrystalReportViewer1.PrintReport

Figure 4-21

This will open a standard Windows print that will allow you to print your report. If you need to access advanced print options (like printing two pages to separate paper trays) or if you want to control the print process manually, you will need to use the Report Engine to do so, which is covered in Chapter 8, "Formulas and Logic."

Was this article helpful?

0 0

Post a comment