Sending multiple reports to the screen instead of the printer.
I would like to be able to view three reports on the screen and then print
them if desired. I found in the help the example below which prints the
reports correctly but I have not find how to make it just go to the screen
device first by using a similar approach. Any suggestions?
My reports are full reports and not subreports. They also inherit some
features from their parents. I am aware that we can place three subreports
in a detail band and then run them as one. This method does show all
reports on the screen. I have done it but it involves creating separate
data modules which I am trying to avoid if possible.
Your input in this matter will be greatly appreciated. Many thanks in
advance!
Emeria Beltran
********************************
From RB help:
"Sending Multiple Reports to a single Print Job example"
procedure TForm1.Button1Click(Sender: TObject);
var
lPrinterDevice: TppPrinterDevice;
begin
{create printer device}
lPrinterDevice := TppPrinterDevice.Create(Self);
{only request the first page of each report}
lPrinterDevice.PageSetting := psFirstPage;
{print first report}
lPrinterDevice.StartPrintJob := True;
lPrinterDevice.EndPrintJob := False;
lPrinterDevice.Publisher := ppCustomerList.Publisher;
ppCustomerList.PrintToDevices;
{print middle report}
lPrinterDevice.StartPrintJob := False;
lPrinterDevice.EndPrintJob := False;
lPrinterDevice.Publisher := ppOrderList.Publisher;
ppOrderList.PrintToDevices;
{print last report}
lPrinterDevice.StartPrintJob := False;
lPrinterDevice.EndPrintJob := True;
lPrinterDevice.Publisher := ppStockList.Publisher;
lPrinterDevice.PageSetting := psFirstPage;
ppStockList.PrintToDevices;
{free device}
lPrinterDevice.Free;
end;
them if desired. I found in the help the example below which prints the
reports correctly but I have not find how to make it just go to the screen
device first by using a similar approach. Any suggestions?
My reports are full reports and not subreports. They also inherit some
features from their parents. I am aware that we can place three subreports
in a detail band and then run them as one. This method does show all
reports on the screen. I have done it but it involves creating separate
data modules which I am trying to avoid if possible.
Your input in this matter will be greatly appreciated. Many thanks in
advance!
Emeria Beltran
********************************
From RB help:
"Sending Multiple Reports to a single Print Job example"
procedure TForm1.Button1Click(Sender: TObject);
var
lPrinterDevice: TppPrinterDevice;
begin
{create printer device}
lPrinterDevice := TppPrinterDevice.Create(Self);
{only request the first page of each report}
lPrinterDevice.PageSetting := psFirstPage;
{print first report}
lPrinterDevice.StartPrintJob := True;
lPrinterDevice.EndPrintJob := False;
lPrinterDevice.Publisher := ppCustomerList.Publisher;
ppCustomerList.PrintToDevices;
{print middle report}
lPrinterDevice.StartPrintJob := False;
lPrinterDevice.EndPrintJob := False;
lPrinterDevice.Publisher := ppOrderList.Publisher;
ppOrderList.PrintToDevices;
{print last report}
lPrinterDevice.StartPrintJob := False;
lPrinterDevice.EndPrintJob := True;
lPrinterDevice.Publisher := ppStockList.Publisher;
lPrinterDevice.PageSetting := psFirstPage;
ppStockList.PrintToDevices;
{free device}
lPrinterDevice.Free;
end;
This discussion has been closed.
Comments
The options are as you describe. Use the PrinterDevice to chain multiple
reports - this does not support preview. Or use a main report that contains
multiple section style subreports in the detail band - this does support
preview.
Since you do not want to load the existing reports into subreports, I
suggest you using a slightly different technique in which the subreports
reference your existing TppReport objects.
1. Create a main report with multiple section subreports in the detail band.
2. For each subreport, use the SubReport.SetReportProperty to establish a
reference to the existing TppReport object.
3. After you are finished printing, call SubReport.SetReportProperty(nil) to
remove the relationship.
Example:
mySubreport1.SetReportProperty(myFirstReport);
mySubreport2.SetReportProperty(mySecondReport);
myMainReport.Print;
mySubreport1.SetReportProperty(nil);
mySubreport2.SetReportProperty(nil);
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks to your help it did work. Super!
Emeria