This walkthrough illustrates how to set the type of duplex action to use when printing out double-sided reports.
This walkthrough is split up into the following activities:
- Accessing the printer settings dialog
- Setting the type of duplexing for printing double-sided reports
- Using code to set the type of duplexing for printing
- Viewing the report
To complete this walkthrough, you must have a print driver which supports printing in duplex in .NET.
Accessing the printer settings dialog
To access the printer settings dialog
- Open an existing ActiveReport.
- Click on any section of the report to select it.
- Click on Report > Settings.
- Click on Printer Settings.
Setting the type of duplexing for printing double-sided reports
To set the type of duplexing for printing double-sided reports
- Go to the printer settings dialog.
- For Duplex, choose one of the four options:
Printer default: the report will use the default setting on the selected printer.
Simplex: turns off duplex printing.
Horizontal: prints horizontally on both sides of the paper.
Vertical: prints vertically on both sides of the paper.
Using code to set the type of duplexing at run time
To write the code in Visual Basic or C#
- Double-click in the gray section underneath the report to create an event-handling method for the report's ReportStart event. Add code to the handler to:
- Set the type of duplexing needed in the report
The following example shows what the code for the method looks like for setting horizontal duplexing.
'Visual Basic
Private Sub rptKeepTG_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles MyBase.ReportStart
Me.PageSettings.Duplex = Drawing.Printing.Duplex.Horizontal
End Sub
//C#
private void rptprint_ReportStart(object sender, System.EventArgs eArgs)
{
this.PageSettings.Duplex = System.Drawing.Printing.Duplex.Horizontal
}
Viewing the report
To view the report
- Add the ActiveReports viewer control to a Windows Form.
- Add the code needed to set the viewer document equal to the report document. See Using the ActiveReports Windows Form Viewer for help.
You can quickly view your report at design time by clicking the Preview tab at the bottom of the designer. |