Rave - General
I have a number of reports that I want to send to the printer without creating a separate print jobs for each report. How would I do this?
Normally, you would call RaveProject1.ExecuteReport('ReportName') for each report that you want printed. This does, however, create a separate print jobs for each report that is printed. Often it is desirable to send multiple print jobs to the printer as a single print job, preventing other print jobs from getting mixed in with the report from others printing over the network. This can be done using a ReportSystem component in combination with the RaveProject component.
Simply drop down a ReportSystem component along with your RaveProject component. Set the engine property of the RaveProject component to point to the ReportSystem component. Then define an OnPrint event for the ReportSystem component. In the OnPrint event you would write code similar to this:
Delphi Example
with Sender as TBaseReport do begin RaveProject.ExecuteReport('Report1'); NewPage; RaveProject.ExecuteReport('Report2'); NewPage; RaveProject.ExecuteReport('Report3'); end; { with }
C++Builder Example
TBaseReport* bp = dynamic_cast(Sender); RaveProject->ExecuteReport("Report1"); bp->NewPage(); RaveProject->ExecuteReport("Report2"); bp->NewPage(); RaveProject->ExecuteReport("Report3");
Then when you want to print your report, you would call ReportSystem.Execute, if you are using Delphi or ReportSystem->Execute(), if you are using BCB. This method has the added advantage of allowing you to preview the entire report at one time.
One thing you should be aware of is that if you are printing reports, some in landscape and some in portrait, the first page will always be that as set in the ReportSystem component, since by the time it gets to the OnPrint event the page orientation has already been set. To solve this problem you will need to set the orientation of the ReportSystem component to be that of the first page of the first report being generated.