Does anyone know if there is a way to combine multiple reports into one print job, so that you only get one print dialog, but all the separate ppReport objects output their separate reports?
What you do in principle is create a subreport with PrintBehaviour pbSection for each ot the parts and add it to a "master report". You use SubReport.SetReportProperty(PartReport) to assign any report to be printed as the subreport.
I learned about it from a sample called "compound report" from the Digital-Metaphors-Site. I do not have the exact link, if you cannot find it I will try to dig out my download as the code itself has long been assimilated into my project beyond recognition :-).
Ciao, MM -- Marian Aldenhövel, Hainstraße 8, 53121 Bonn http://www.marian-aldenhoevel.de "Wussten Sie, daß schon der Biss eines einzigen Pferdes eine Hornisse töten kann?"
begin //create the report lSubReport := TppSubReport.Create(frmTables); lSubReport.Band := ppReport.DetailBand;// ppDetailBand1; lSubReport.CreateReport(TppReport(ppReport.DetailBand.Report)); lSubReport.PrintBehavior := pbSection; lSubReport.ParentPrinterSetup := False;
//load the report lMS := TMemoryStream.Create; try if not tblReports.Locate('Report_ID', aReportID, []) then raise exception.Create(Format('Report_ID not found. [%d]', [aReportID]));
Comments
I know there is a way.
What you do in principle is create a subreport with PrintBehaviour
pbSection for each ot the parts and add it to a "master report". You use
SubReport.SetReportProperty(PartReport) to assign any report to be printed
as the subreport.
I learned about it from a sample called "compound report" from the
Digital-Metaphors-Site. I do not have the exact link, if you cannot find it
I will try to dig out my download as the code itself has long been
assimilated into my project beyond recognition :-).
Ciao, MM
--
Marian Aldenhövel, Hainstraße 8, 53121 Bonn
http://www.marian-aldenhoevel.de
"Wussten Sie, daß schon der Biss eines einzigen
Pferdes eine Hornisse töten kann?"
Just as Martin said: create a sub report in a TppReport, load each report
into that. I do this. Here is an edited versio of my code:
procedure LoadSubReport(aReportID: integer);
var
lSubReport: TppSubReport;
lMS: TMemoryStream;
lppImage: TppImage;
lppPageStyle: TppPageStyle;
begin
//create the report
lSubReport := TppSubReport.Create(frmTables);
lSubReport.Band := ppReport.DetailBand;// ppDetailBand1;
lSubReport.CreateReport(TppReport(ppReport.DetailBand.Report));
lSubReport.PrintBehavior := pbSection;
lSubReport.ParentPrinterSetup := False;
//load the report
lMS := TMemoryStream.Create;
try
if not tblReports.Locate('Report_ID', aReportID, []) then
raise exception.Create(Format('Report_ID not found. [%d]',
[aReportID]));
tblReportsTheReport.SavetoStream(lMS);
lMS.Position := 0;
lSubReport.Report.Template.LoadFromStream(lMS);
finally
lMS.Free;
end; // try/finally
lSubReport.ResetPageNo := False;
end
HTH,
Ed Dressel
Team DM