RpReport Class Overview

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

RpReport Class Overview

Previous pageReturn to chapter overviewNext page


The RpReport class provides access to the ReportPro runtime engine.  The ReportPro runtime allows you to integrate reports created with the ReportPro design environment into your application.  


The basic concept behind ReportPro is to design a report using the ReportPro design environment and then write code in your application to print the report.  The task of printing a report from your application is simple and requires only a few lines of code:




METHOD PrintReport CLASS StandardShellWindow


LOCAL oReport AS RpReport

LOCAL cJobName,cPrint2Filename,cCaption,cMessage AS STRING


oReport := RpReport{ SELF, "C:\RP2\BIT.RPT" }


IF oReport:IsValid


 cJobName             := "My Report"

 cPrint2Filename      := "REPORT.PRN"

 cCaption            := "My App Name"

 cMessage            := "Printing in progress..."







First the RpReport object is instantiated.  


Next, the RpReport object is checked to insure the report initialized correctly.  You should always test the IsValid access.  If the report initializes correctly, it can be sent to either the printer or print preview window.  If IsValid returns false, you should not attempt to print or preview the report.


Next, Print or PrintPreview is called. During this process, the tables in the data source are opened.  If the report is ODBC based, ReportPro connects to the designated SQL server and submits the SQL query.


In all cases, it is necessary to close the report when you are finished with the RpReport object.  This allows ReportPro to clean up and free resources.


The RpReport contains many additional methods that allow you to completely control the reporting process.  Each of these methods is fully documented in the next chapter.