Introduction Congratulations! You've made an excellent choice. ReportPrinter was designed to give the power of reporting back to the programmer where it belongs. ReportPrinter does this by offering a powerful suite of printing components that simplify the task of creating professional reports. ReportPrinter does not need any extra .DLL's, .VBX's or .EXE's. Reports are written in Delphi and are compiled into the application for easier distribution and faster execution. ReportPrinter also features a powerful print preview component that allows reports to be displayed quickly and accurately to the user's screen. Read through this manual and the examples on the accompanying disk and you'll soon be turning nightmare printing jobs into dream reports. Installation Installing the ReportPrinter component suite is an easy process. If you have installed an older or demo copy of ReportPrinter, first remove all instances of those files from the component library and your hard disk before continuing with the installation process. If you do not do this you may get type mismatch or other errors. Step 1: Backup the component library file called COMPLIB.DCL in your \DELPHI\BIN directory. If you encounter any problems during the installation process, you can restore your component library by restoring this file. Step 2: Copy the files in the INSTALL sub directory found on the distribution disk into a directory on your hard disk (\DELPHI\LIB or \DELPHI\ADDON are good choices). Step 3: Load up Delphi and select Options|Install Components from the Delphi menu bar. Once the Install Components dialog window is displayed, click on the Add button and select the file RPREG.PAS in the directory that the ReportPrinter files were copied into in Step 2. You should use the Browse button to do this. Step 4: Click OK to return to the Install Components dialog box and then click OK to accept the changes. Delphi will now re-compile your component library. Once it is finished, you should have a new page on your component bar called Report that contains the new ReportPrinter components. NOTE: If you want to change the component page that the ReportPrinter components are installed into, modify the RegisterComponents call in RPREG.PAS before beginning the installation. If at any time you make changes to the ReportPrinter files, make sure you re-compile the component library by selecting Options|Rebuild Library from the Delphi menu bar. Component Overview TReportPrinter The TReportPrinter component is the primary reporting component and sends report output directly to the printer. To create a report with TReportPrinter, place the component on a form. The properties and events can then be customized or coded for the report. To run the report, simply call the Execute method. Execute will first call the OnBeforePrint event, then call the printing events, then call the OnAfterPrint event. The OnBeforePrint and OnAfterPrint events are called before and after the print job is active and therefore, the printer canvas is not valid. Code inside of these events should call only non-printing code such as opening or closing of tables or the setting of published TReportPrinter properties. Printing the body of the report is done with one of two event handlers: OnPrint and OnPrintPage. See their descriptions in the reference section for more information on how these events differ. OnPrintHeader, OnPrintFooter and OnNewPage are called for each page that is printed. OnNewPage is called before any printing code is done for that page to allow you to set the page up. OnPrintHeader is called after OnNewPage. OnPrintFooter is called after all printing for a page is completed but before the next page is activated. TReportFiler The TReportFiler component is used to generate a special report file that can later be used by the TFilePrinter and TFilePreview components. A report is generated the same way as the code in a TReportPrinter report except that the report is sent to a file (or other stream) instead of the printer. TFilePrinter The TFilePrinter component is used to send a report file previously generated from TReportFiler to the printer. To print a report with TFilePrinter, place the component on a form. Then initialize the FileName property for the report file to print. To print the report file, simply call the Execute method. You can also call ExecuteCustom to print a portion of the report file or to change the number of copies. TFilePreview The TFilePreview component is used to send a report file generated from TReportFiler to a preview form. The construction of this form must include a scrollbox and could include other features such as buttons or spin boxes to control the current page and zoom factor.