This walkthrough illustrates how to make simple modifications to the page orientation of your report for printing.
This walkthrough is split up into the following activities:
- Accessing the printer settings dialog
- Changing the page orientation of your report for printing
- Using code to change the page orientation for printing
- Viewing the report
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.
Changing the page orientation of your report for printing
To change the page orientation of your report for printing
- Go to the printer settings dialog.
- In the orientation box, select either portrait or landscape.
- Click OK to return to the report.
Note Page orientation can only be modified before the report runs. Otherwise, changes made to the page orientation will not be reflected when printed.
Using code to change the page orientation
To write the code in Visual Basic
- Right-click in any section of the design window of your report, and click on View Code to display the code view for the report. At the top left of the code view for the report, click the drop-down arrow and select (Base Class Events). At the top right of the code window, click the drop-down arrow and select ReportStart. This creates an event-handling method for the report's ReportStart event. Add code to the handler to:
- Change the page orientation of the report for printing
To write the code in C#
- Click in the gray section underneath the report to select the report. Click on the events icon in the Properties window to display available events for the report. Double-click ReportStart. This creates an event-handling method for the report's ReportStart event. Add code to the handler to:
- Change the page orientation of the report for printing
The following example shows what the code for the method looks like for changing the page orientation to landscape.
' Visual Basic
Private Sub rptPrint_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.ReportStart
Me.PageSettings.Orientation = PageOrientation.Landscape
End Sub
//C#
private void rptPrint_ReportStart(object sender, System.EventArgs eArgs)
{
this.PageSettings.Orientation = DataDynamics.ActiveReports.Document
.PageOrientation.Landscape;
}
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 WinForm Viewer for help.
Samples | Walkthroughs
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.