TppPrinterDevice to Preview
Hello,
I need to combine two different reports and show them on screen to the user.
In the code below, how could I do this? Or would there be a better alternative?
procedure TForm1.Button1Click(Sender: TObject);
var
lPrinterDevice: TppPrinterDevice;
begin
lPrinterDevice := TppPrinterDevice.Create(Self);
lPrinterDevice.Stackable := True;
{assign printer device's printer to report - note: do not use assign here}
ppReport.PrinterSetup.PrinterName := lPrinterDevice.Printer.PrinterSetup.PrinterName;
ppReport.PrinterSetup.Copies := lPrinterDevice.Printer.PrinterSetup.Copies;
{print first report}
lPrinterDevice.StartPrintJob := True;
lPrinterDevice.EndPrintJob := False;
lPrinterDevice.Publisher := ppReport.Publisher;
ppReport.PrintToDevices;
{print last report}
lPrinterDevice.StartPrintJob := False;
lPrinterDevice.EndPrintJob := True;
lPrinterDevice.Publisher := ppReport.Publisher;
ppReport.PrintToDevices;
{free device}
lPrinterDevice.Free;
end;
I need to combine two different reports and show them on screen to the user.
In the code below, how could I do this? Or would there be a better alternative?
procedure TForm1.Button1Click(Sender: TObject);
var
lPrinterDevice: TppPrinterDevice;
begin
lPrinterDevice := TppPrinterDevice.Create(Self);
lPrinterDevice.Stackable := True;
{assign printer device's printer to report - note: do not use assign here}
ppReport.PrinterSetup.PrinterName := lPrinterDevice.Printer.PrinterSetup.PrinterName;
ppReport.PrinterSetup.Copies := lPrinterDevice.Printer.PrinterSetup.Copies;
{print first report}
lPrinterDevice.StartPrintJob := True;
lPrinterDevice.EndPrintJob := False;
lPrinterDevice.Publisher := ppReport.Publisher;
ppReport.PrintToDevices;
{print last report}
lPrinterDevice.StartPrintJob := False;
lPrinterDevice.EndPrintJob := True;
lPrinterDevice.Publisher := ppReport.Publisher;
ppReport.PrintToDevices;
{free device}
lPrinterDevice.Free;
end;
Comments
When merging two reports on screen there are two main options:
1. Create a parent report with multiple Section subreports inside the detail band. Load each report template into each subreport before printing to screen.
2. Use the built-in archive merge utility to generate and merge multiple reports to a single archive and view in the previewer. TppArchiveReader.MergeUtility.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com