Subreports, same template and same datapipeline??
I have a requierment to produce a merged report containing 1 or more
copies of the same report, each with different where conditions in the
sql.
ppDailySummary2 (Only has a detail band)
|--SubReport1
|--SubReport2
|--SubReport3
etc, etc.
To create the report at runtime I use the following, the OnPrint closes
the dataset, re-writes the sql and then re-opens the dataset.
ReportStream := TMemoryStream.Create;
ppInfoPage.Template.SaveToStream(ReportStream);
for RepCounter := 1 to SelectedReports.count do
begin
SubReport := TppSubReport.Create(nil);
SubReport.Band := ppDailySummary2.DetailBand;
SubReport.PrintBehavior := pbSection;
SubReport.ResetPageNo := false;
SubReport.CreateReport(ppDailySummary2);
SubReport.OnPrint := ppDailyReportSubreportPrint;
SubReport.Report.Template.LoadFromStream(ReportStream);
SubReport.Tag := RepCounter;
SubReports.DataPipeline := ppplInfoPage;
end;
ReportStream.Free;
It works fine, print previews okay, save to pdf etc ok (using Gnostice)
but when I print to a printer from the print preview the first
page/subreport is blank when printed, all others subreports are printed
ok.
I get the same problem if I set the PassSetting to psTwoPass, while the
print preview is generating the various pages I can see the first page
ok, as soon as the second pass is complete the first page goes blank!
I've read warnings about using subreports with the same datapipeline
but do I have to go to the lengths of creating multiple pipelines,
datasources and datasets at runtime to support the requierement?
I've also tried CachePages = true but this doesn't make any difference.
Any help would be really appreciated.
Cary.
(D7.1/RB9.01 Ent)
copies of the same report, each with different where conditions in the
sql.
ppDailySummary2 (Only has a detail band)
|--SubReport1
|--SubReport2
|--SubReport3
etc, etc.
To create the report at runtime I use the following, the OnPrint closes
the dataset, re-writes the sql and then re-opens the dataset.
ReportStream := TMemoryStream.Create;
ppInfoPage.Template.SaveToStream(ReportStream);
for RepCounter := 1 to SelectedReports.count do
begin
SubReport := TppSubReport.Create(nil);
SubReport.Band := ppDailySummary2.DetailBand;
SubReport.PrintBehavior := pbSection;
SubReport.ResetPageNo := false;
SubReport.CreateReport(ppDailySummary2);
SubReport.OnPrint := ppDailyReportSubreportPrint;
SubReport.Report.Template.LoadFromStream(ReportStream);
SubReport.Tag := RepCounter;
SubReports.DataPipeline := ppplInfoPage;
end;
ReportStream.Free;
It works fine, print previews okay, save to pdf etc ok (using Gnostice)
but when I print to a printer from the print preview the first
page/subreport is blank when printed, all others subreports are printed
ok.
I get the same problem if I set the PassSetting to psTwoPass, while the
print preview is generating the various pages I can see the first page
ok, as soon as the second pass is complete the first page goes blank!
I've read warnings about using subreports with the same datapipeline
but do I have to go to the lengths of creating multiple pipelines,
datasources and datasets at runtime to support the requierement?
I've also tried CachePages = true but this doesn't make any difference.
Any help would be really appreciated.
Cary.
(D7.1/RB9.01 Ent)
This discussion has been closed.
Comments
Usually when the preview output does not match the printed output, it is due
to some event code firing at an unwanted time (perhaps twice in your case).
Try placing a stop in each of your event handlers and note the differences
between the events that fire during the preview and during printing.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com