Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Footers (PrintOnFirstPage / PrintOnLastPage)

edited August 2002 in General
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

Comments

  • edited August 2002
    I've reviewed that article which does help on one page reports. But my issue
    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

  • edited August 2002
    Please see the Tech-Tip newsgroup in the Code Based thread for an article
    called:
    'Using PrintOnFirstPage for One Page Reports'



    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited August 2002
    Yes, that makes sense. I'll give your suggestion a try. Thanks again Jim.

  • edited August 2002
    The PrintOnLastPage property is only designed to support toggling o fthe
    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

This discussion has been closed.