Hi, I've a problem! I must build a report with pagelimit, but I must print in the last page a summary! If I set pagelimit and pages number is greater then pagelimit, summary band not printed! What must I do? Thanks! Vittorio Schiavinato
You could use the Report.OnEndPage event to check the Report.Engine.AbsolutePageNo to see if you have just finished printing on the second to last page based on the page limit number. If so, then tell the datapipeline to Skip until the EOF is found. This way you'll skip the rest of the data and the summary band of the report will print on the last page. The summary will only contain the info for the pages which have printed.
Hi Jim, thank you very much. The correct event is OnBeginPage! :-) But now I've a second problem: when in this event I write this:
if ppReport.Engine.AbsolutePageNo=ppReport.PageLimit then while not ppReport.DataPipeline.EOF do ppReport.DataPipeline.Skip;
In the top of last page, before summary band, there is one record printed! I think it is a record that, in the preview page, didn't print because it was too height for the page. What can I do? Thanks Vittorio Schiavinato
I haven't got a demo working yet in one pass. I'll give it a go today and see if I can force the summary to be correct, after stopping the engine halfway through a detail subreport. So far the engine isn't letting me generate a summary band normally on the last page. Looks like we'll have to check the page number in the variable summary calculations in order to stop them from calculating a summary on the records printing on the last page. Then free the draw commands for those records we couldn't stop and hen tell the summary to print at the top of the last page. Use the OnStartPage to tell the engine to try and stop, it will, but the next page will generate the remaining records of a subreport. Then use the SummaryBandBeforePrint to free the draw commands on the page and tell the engine to start at the top.
procedure TForm1.ppReport1StartPage(Sender: TObject); begin
if (ppReport1.Engine.AbsolutePageNo = (ppReport1.PageLimit)) then begin
ppReport1.DataTraversalCompleted;
end;
end;
procedure TForm1.ppSummaryBand1BeforePrint(Sender: TObject); var lPage: TppPage; begin
if false and (ppReport1.Engine.AbsolutePageNo = (ppReport1.PageLimit)) then begin
lPage := ppReport1.Engine.Page;
{whatever the report generated, remove it} lPage.FreeDrawCommands;
{move to top of page 0.25 inches from top to account for margin of 0.25 inches = 6350 microns}
Comments
Report.Engine.AbsolutePageNo to see if you have just finished printing on
the second to last page based on the page limit number. If so, then tell
the datapipeline to Skip until the EOF is found. This way you'll skip the
rest of the data and the summary band of the report will print on the last
page. The summary will only contain the info for the pages which have
printed.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
thank you very much.
The correct event is OnBeginPage! :-)
But now I've a second problem: when in this event I write this:
if ppReport.Engine.AbsolutePageNo=ppReport.PageLimit then
while not ppReport.DataPipeline.EOF do
ppReport.DataPipeline.Skip;
In the top of last page, before summary band, there is one record printed!
I think it is a record that, in the preview page, didn't print because it
was too height for the page.
What can I do?
Thanks
Vittorio Schiavinato
see if I can force the summary to be correct, after stopping the engine
halfway through a detail subreport. So far the engine isn't letting me
generate a summary band normally on the last page. Looks like we'll have to
check the page number in the variable summary calculations in order to stop
them from calculating a summary on the records printing on the last page.
Then free the draw commands for those records we couldn't stop and hen tell
the summary to print at the top of the last page. Use the OnStartPage to
tell the engine to try and stop, it will, but the next page will generate
the remaining records of a subreport. Then use the SummaryBandBeforePrint
to free the draw commands on the page and tell the engine to start at the
top.
procedure TForm1.ppReport1StartPage(Sender: TObject);
begin
if (ppReport1.Engine.AbsolutePageNo = (ppReport1.PageLimit)) then
begin
ppReport1.DataTraversalCompleted;
end;
end;
procedure TForm1.ppSummaryBand1BeforePrint(Sender: TObject);
var
lPage: TppPage;
begin
if false and (ppReport1.Engine.AbsolutePageNo = (ppReport1.PageLimit))
then
begin
lPage := ppReport1.Engine.Page;
{whatever the report generated, remove it}
lPage.FreeDrawCommands;
{move to top of page 0.25 inches from top to account for margin of
0.25 inches = 6350 microns}
{procedure TppCustomEngine.SetPrintPosition(Left, Top, Right, Bottom:
Longint);}
ppReport1.Engine.SetPrintPosition(6350,
ppReport1.Engine.PrintPosRect.Left, ppReport1.Engine.PrintPosRect.Right,
ppReport1.Engine.PrintPosRect.Bottom);
end
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
trying to make it out to be.
http://www.digital-metaphors.com/tips/PageLimitWithSummary.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com