Footers (PrintOnFirstPage / PrintOnLastPage)
I have a footer on my report (no groups) in which I set PrintOnFirstPage to
False and PrintOnLastPage to True. If my report has more than two pages (say
three) the footer does not print on the first page but it does print on the
second and third pages. What am I doing wrong?
mbd
False and PrintOnLastPage to True. If my report has more than two pages (say
three) the footer does not print on the first page but it does print on the
second and third pages. What am I doing wrong?
mbd
This discussion has been closed.
Comments
is that for reports with more than two pages the footer prints on the second
AND third page. Is it supposed to that or is it supposed to only print on
the third page? What I want is for the footer to only print on the very last
page.
Note: If my report is only two pages then everything works great.
mbd
called:
'Using PrintOnFirstPage for One Page Reports'
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
footerband to be printed on the last page. It does not mean that it will
print only on the last page. To get the behavior that you want, add a check
in the band's BeforePrint event to check if the Report.AbsolutePageNo =
Report.AbsolutePageCount. This will require a two pass report
(Report.PassSetting = psTwoPass). The other option is to use a one pass
report, and in the Report.OnEndPage event, check is
Report.Engine.Pape.LastPage is true. If it is, then you can free the draw
commands created for hte footer. To do this, you need to create a TList.
Use the OnDrawCommandCreate events of all the controls in the footer band
and stick the drawcommand object passed in the event into the TList. You'll
have to clear this list in the Report.OnStartPage event to clear the
previous page's draw command handles, since you won't know if any page is
the last page. In the OnEndPage, you can loop through these draw commands
and set their Parent property to nil and free the draw commands in the
TList. When you nil the parent property, the page object removes the draw
command from the page. You can also call
Report.Engine.Page.RemoveDrawCommand to do this.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com