[]
In a Section Report, you can modify various printer settings or print multiple copies of a report at design time and at run time.
Section reports depend on default printer settings may require some extra configuration.
var rpt = new SectionReport();
rpt.Document.Printer.Name = "";
type=note
Note: It is recommended to set the printer name as empty if you not sure about target environments.
At design time, you can set up duplex printing, page orientation, collation, and page size in the Printer Settings tab of the Report Settings Dialog.
Double-click the gray area below the design surface to create an event-handling method for the report's ReportStart event.
Add the following code to the handler to set up duplexing.
To write the code in Visual Basic.NET
Me.PageSettings.Duplex = GrapeCity.ActiveReports.Printing.Duplex.Horizontal
To write the code in C#
this.PageSettings.Duplex = GrapeCity.ActiveReports.Printing.Duplex.Horizontal;
Double-click the gray area below the design surface to create an event-handling method for the report's ReportStart event.
Add the following code to the handler to change the page orientation of the report for printing.
type=note
Note: Page orientation can only be modified before the report runs. Otherwise, changes made to the page orientation are not used during printing.
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Me.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Landscape
To write the code in C#
this.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Landscape;
You can print multiple copies using the Print dialog in the Preview tab or in the Viewer, or you can use code to set the number of copies to print.
Double-click in the gray area below the design surface to create an event-handling method for the report's ReportStart event.
Add the following code to the handler to set multiple copies of the report for printing.
The following example shows what the code for the method looks like for printing five copies.
To write the code in Visual Basic.NET
Me.Document.Printer.PrinterSettings.Copies = 5
Me.Document.Printer.Print()
To write the code in C#
this.Document.Printer.PrinterSettings.Copies = 5;
this.Document.Printer.Print();