Home RAP

Dynamic footer questions

edited February 2010 in RAP

I am trying to create a dynamic footer band in ReportBuilder 11.06 w/ Delphi

I need this because I have 3 types of footers, which are dynamic in height
and must be aligned to bottom.
- 2 footers should only print on the first page
- 1 should print on every page
- 1 should only print on the last page

The detailband contains a subreport that could get large (so I do not loop
through details in the mainreport).

So far I have managed to come up with the code below, placed in the
OnStartPage command. This creates the following problem (but only
- Report generates and calculates all bands.
- It detects that footer + detail band cannot fit on the last page and
breaks the detail to the next page.
- At this moment, the lastpage footer is also moved to the last page,
freeing up space on the second to last page and thus preventing the break.

This keeps going over and over again leading to a report that generates an
endless amount of pages when printing (preview seems to be OK), printing the
last page and page before over and over again.

Almost forgot to mention, the report is a 2-pass report.

Does anyone have any idea how to prevent this?

Roald van Doorn

procedure ReportOnStartPage;
localMemo : TppCustomMemo;
totalHeight : Double;
totalHeight := 0;

{set visibility}
SubReportFooterPage1a.Visible := (Report.PageNo = 1);
SubReportFooterPage1b.Visible := (Report.PageNo = 1);
SubReportFooterAllPages.Visible := (Report.PageNo = Report.PageCount);

{calc footer height}

if SubReportFooterPage1a.Visible then begin
totalHeight := totalHeight + SubReportFinancVoorbeeld.Height;

if SubReportFooterPage1b.Visible then
SubReportFooterPage1b.Top := TotalHeight;
totalHeight := totalHeight + SubReportGarPlus.Height;

if SubReportFooterAllPages.Visible then
SubReportFooterAllPages.Top := TotalHeight;
totalHeight := totalHeight + SubReportFooter.Height;

{This footer contains a memo which stretches to the amount of text,
GetMemoHeight is a
self-made function that calculates the height of a given memo, with a
certain amount of text}
if SubReportFooterLastPage.Visible then
localMemo := FindComponent(SubReportFooterLastPage.Report,
if localMemo <> nil then
localMemo.Height := GetMemoHeight(localMemo,
SubReportFooterLastPage.Height := localMemo.Height + 0.1;
SubReportFooterLastPage.Top := TotalHeight;
totalHeight := totalHeight + SubReportFooterLastPage.Height;

{increase height of footer for pagenumbers}
Footer.Height := totalHeight + (2 * LabelPageNo.Height);

LabelPageNo.Top := Footer.Height - LabelPageNo.Height;
dbFooterLine.Top := LabelPageNo.Top;


  • edited February 2010
    Hi Roald,

    Instead of using a footer in this case, perhaps try using the Summary Band
    with the FooterBand.PrintOnLastPage := False.


    Nico Cizik
    Digital Metaphors

    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited February 2010
    Hi Nico,

    Thanks for your suggestion, I have been experimenting with this too. The
    problem I had with this was that the footer that should go on every apge is
    a 'signature' block for a contract, while the block that should only go on
    the last page contains the 'small print.'
    Preferably I wanted the small print _below_ the signature on the last page,
    yet the signature at the bottom of the page for every other page. I
    eventually solved this by setting PrintOnLastPage=False for the Footer and
    copying the signature block to the summary band and setting this
    AlignToBottom=True. Not as nice, but it works the way I want it to.



This discussion has been closed.