ActiveReports Developer provides access to Print methods to enable printing of page and section reports. You can access Print methods in any of the following ways:
- Viewer.Print method
- Print methods in SectionDocument or PageDocument
- Print methods in the PrintExtension class
The following code samples illustrate how to access these Print methods.
You can use the Print method of the Viewer class to print a report loaded in the Viewer control. Make sure that the report is loaded completely before Print is executed.
To write the code in Visual Basic.NET
| Visual Basic.NET code. Add this code INSIDE the LoadCompleted event of the Viewer | Copy Code |
|---|---|
| Viewer1.Print(True, True, True) | |
| C# code. Add this code INSIDE the LoadCompleted event of the Viewer | Copy Code |
|---|---|
| viewer1.Print(true, true, true); | |
Print methods in SectionDocument or PageDocument
SectionDocument and PageDocument types have Print methods that can be used directly on the document object.
To write the code in Visual Basic.NET
| Visual Basic.NET code. Paste at the top of the code view. | Copy Code |
|---|---|
| Imports GrapeCity.ActiveReports | |
| Visual Basic.NET code. Paste INSIDE the Form_Load event. | Copy Code |
|---|---|
| Dim rpt = New SectionReport1() rpt.Run(False) Dim sectionDocument = rpt.Document sectionDocument.Print(True, True, False) |
|
| C# code. Paste at the top of the code view. | Copy Code |
|---|---|
| using GrapeCity.ActiveReports; | |
| C# code. Paste INSIDE the Form_Load event. | Copy Code |
|---|---|
| var rpt = new SectionReport1(); rpt.Run(false); var sectionDocument = rpt.Document; sectionDocument.Print(true, true, false); |
|
To write code in Visual Basic.NET
| Visual Basic.NET code. Paste at the top of the code view. | Copy Code |
|---|---|
| Imports GrapeCity.ActiveReports | |
| Visual Basic.NET code. Paste INSIDE the Form_Load event. | Copy Code |
|---|---|
| Dim file_name As String = "..\..\PageReport1.rdlx" Dim pageReport As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(file_name)) Dim pageDocument As New GrapeCity.ActiveReports.Document.PageDocument(pageReport) pageDocument.Print(True, True, False) |
|
| C# code. Paste at the top of the code view. | Copy Code |
|---|---|
| using GrapeCity.ActiveReports; | |
| C# code. Paste INSIDE the Form_Load event. | Copy Code |
|---|---|
| string file_name = @"..\..\PageReport1.rdlx"; GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name)); GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport); pageDocument.Print(true, true, false); |
|
![]() |
Note: The Print method is similar to PrintExtension.Print. For details see Print methods in the PrintExtension class below. |
Print methods in the PrintExtension class
You can use the Print method of the PrintExtension class to print a report loaded in the Viewer control. Make sure that the report is loaded completely before Print is executed.
To write code in VisualBasic.NET
| Visual Basic.NET code. Paste INSIDE an event like Button_Click. | Copy Code |
|---|---|
| GrapeCity.ActiveReports.PrintExtension.Print(sectionDocument, True, True) | |
| C# code. Paste INSIDE an event like Button_Click. | Copy Code |
|---|---|
| GrapeCity.ActiveReports.PrintExtension.Print(sectionDocument, true, true); | |
To write code in VisualBasic.NET
| Visual Basic.NET code. Paste INSIDE an event like Button_Click. | Copy Code |
|---|---|
| GrapeCity.ActiveReports.PrintExtension.Print(pageDocument, True, True) | |
| C# code. Paste INSIDE an event like Button_Click. | Copy Code |
|---|---|
| GrapeCity.ActiveReports.PrintExtension.Print(pageDocument, true, true); | |
![]() |
Note: The Print methods above are accessible through the GrapeCity.ActiveReports.Viewer.Win.v7 assembly. Make sure that you add a reference to this assembly and an Imports (Visual Basic.NET) or using (C#) statement for the GrapeCity.ActiveReports namespace in your project. |
Getting Started
Using the Viewer
Hide All