Because it is an extension of the PrintExtension class, Print is not listed as a method on either of the document classes. You can find it in the GrapeCity.ActiveReports.Viewer.Win.v10 assembly under the GrapeCity.ActiveReports namespace.
There are two ways to call this extended Print method. You can call it on the document object, or call it on the PrintExtension object and pass in the document. I've provided both ways in the code samples below, and commented out one of them. Also, you can see that one of them uses a Section report and the other uses a Page report.
' Visual Basic
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sectionReport As New GrapeCity.ActiveReports.SectionReport()
Dim xtr As New System.Xml.XmlTextReader("..\..\PurchaseOrder.rpx")
Dim sectionDocument = sectionReport.Document
' sectionDocument.Print ' OR
PrintExtension.Print(sectionDocument, True, True)
public partial class Form1 : Form
private void button1_Click(object sender, EventArgs e)
string file_name = @"..\..\Catalog.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(); // OR
PrintExtension.Print(pageDocument, true, true);
If you see error messages like these, the tips below will help.
- 'Print' is not a member of 'PageDocument'.
- 'Print' is not a member of 'SectionDocument'.
- 'PrintExtension' is not declared. It may be inaccessible due to its protection level.
- 'PageDocument' does not contain a definition for 'Print' and no extension method 'Print' accepting a first argument of type 'PageDocument' could be found (are you missing a using directive or an assembly reference?)
- 'SectionDocument' does not contain a definition for 'Print' and no extension method 'Print' accepting a first argument of type 'SectionDocument' could be found (are you missing a using directive or an assembly reference?)
- The name 'PrintExtension' does not exist in the current context.
Reference the Windows Viewer Assembly
To use the Print method, add a reference to the GrapeCity.ActiveReports.Viewer.Win.v10 assembly in your application.
Explicitly Import the Namespace
To enable the Print method, you also need to explicitly import the GrapeCity.ActiveReports namespace. Add code like the following at the beginning of the code file that calls the Print method.
Important: When you upgrade old ActiveReports projects, especially those created using ActiveReports version 6 or lower, the reference and code to import isn't added automatically with the ActiveReports 10 Upgrade tool.
You can find more information on printing in Print Methods In ActiveReports.