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

Printing summary at the bottom of the page

edited November 2007 in General
We need to print the summary on the final page of the report at the bottom
of the page, irrespective of the print position of the final detail line.
The Footer is set not to print on the final page. We need this behaviour
successfully print multi-page documents, such as invoices, especially where
the client uses pre-printed stationery.

In version 7 we put the following code in the BeforePrint of the ppSummary.

ppReport1.Footer.Visible := False;
ppSummaryBand1.PrintPosition := ppReport1.PrinterSetup.PaperHeight -
ppReport1.PrinterSetup.MarginBottom - ppSummaryBand1.Height-
(ppReport1.PrinterSetup.PaperHeight / 100);

In version 10, this seems to cause the Footer not to print after the first
page. The space that would normally be taken up by the footer is filled
with extra detail lines, which are then repeated at the top of the following
page.

I have tried a lot of different variations of this - eg. running the above
code only on the second pass, setting the Footer to be visible in the
Afterprint event, moving the code to the BeforeGenerate event etc. without
success.

How am I meant to do this?

TIA.

Roger Vellacott
Passfield Data Systems ltd

Comments

  • edited November 2007
    Hi Roger,

    1. Instead of manually setting the visibility of the footer band, try
    setting the TppFooterBand.PrintOnLastPage to False.

    2. A more robust way of handling the task of printing the summary band on
    the bottom of the last page is to loop through each draw command and move
    them to the proper position on the page. See the following example on how
    this can be done.

    http://www.digital-metaphors.com/tips/AlignSummaryToBottom.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    Nico,

    Many thanks for the fantastically prompt response.

    I need to cope with users adding new objects, or deleting existing objects,
    from the report design, so I can't hard-code the assignment of the
    DrawCommandCreate methods, as in your example.

    I intend therefore to loop through the objects on the summary band, creating
    a DrawCommand list, as in your example.

    But what is the best point to do this? I would like it to be just before
    printing, rather than on loading the template, or after creating the report,
    as this will allow freedom to dynamically add or remove components without
    having to worry about repositioning them.

    Also, how does one deal with regions, and objects inside regions?

    Does the draw command override a false Visible property?

    Finally, can I suggest a new property on the summary band for a future
    version. "Print at bottom of page". There must be a lot of people who would
    appreciate this.

    TIA

    Roger Vellacott
    Passfield Data Systems Ltd

  • edited November 2007
    Hi Roger,

    I would recommend looping through all of report components in the
    summaryband (perhaps inside the BeforePrint event) and assigning each of
    their OnDrawCommandCreate events manually. Then inside the
    OnDrawCommandCreate you can create the dynamic list of drawcommands.

    Regions are simply rectangles when drawn to the report. They will be moved
    along with any other drawcommands.

    No, the visible property determines whether the drawcommand is created or
    not.

    Yes, we are strongly considering adding this feature to the next major
    release of RB.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    Nico,

    I got this to work well.

    A complication was that Report.Engine.PageBottom does not actually give the
    bottom of the page. It gives the top of the footer band - even on the last
    page and the footer band is set not to print on the last page.

    I fixed it by adding in the SpaceUsed of the footer band to the newly
    calculated top of the summary band.

    Thanks for your help.

    Roger Vellacott
This discussion has been closed.