Problem identifying the last report page
Hi,
I needed to identify the last report page to hide certain graphics on it. I
was told to use the following technique: on before print event for report
header compare page number with page count. So it looks like
procedure TForm1.ppHeaderBand1BeforePrint(Sender: TObject);
begin
ppLine2.Visible := TransactionReport.Page <> TransactionReport.PageCount;
end;
which actually initially worked and did exactly what I needed. Then I ran
into a problem (maybe it is related to the large reports) where it did not
work. It looks like as report gets created it does not know how many pages
to expect so for each page its number basically equals to the page count. If
I pop up report preview and scroll pages back and forth then it works, But
for the first initial print all ppLine2 controls are not printed.
I checked report control and did not find a straight option such as
'generate whole report before printing'. So did I miss something? Or maybe
there is another way to track the last report page?
Thanks,
Serge Goupinets
I needed to identify the last report page to hide certain graphics on it. I
was told to use the following technique: on before print event for report
header compare page number with page count. So it looks like
procedure TForm1.ppHeaderBand1BeforePrint(Sender: TObject);
begin
ppLine2.Visible := TransactionReport.Page <> TransactionReport.PageCount;
end;
which actually initially worked and did exactly what I needed. Then I ran
into a problem (maybe it is related to the large reports) where it did not
work. It looks like as report gets created it does not know how many pages
to expect so for each page its number basically equals to the page count. If
I pop up report preview and scroll pages back and forth then it works, But
for the first initial print all ppLine2 controls are not printed.
I checked report control and did not find a straight option such as
'generate whole report before printing'. So did I miss something? Or maybe
there is another way to track the last report page?
Thanks,
Serge Goupinets
This discussion has been closed.
Comments
Thanks,
Serge Goupinets
You need to set your Report.PassSetting property to psTwoPass and check that
the Report.SecondPass property is True before executing your event code.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Serge