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

How to detect subreport print position on a page?

edited September 2006 in General
Hello,

I have two subreports on my detail band.
I need to print second subreport from another page when first fills more
then 70% of a page.
Can you please suggest something?

--
Eugene Maliavskyy

Comments

  • edited September 2006
    Hi Eugene,

    You can use the TppSubreport.StopPosition property to define where on the
    page you would like the subreport to stop printing before moving to the next
    page.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    "Nico Cizik (Digital Metaphors)" wrote in
  • edited September 2006
    Hi Eugene,

    Thanks for the clairification. There is no built-in feature for
    ReportBuilder that will do this automatically however it is possible to
    measure where the last detail band is printed on a page and based on that
    value, you could toggle the KeepTogether property of the second subreport
    (essentially telling it whether to break to a new page or start printing
    below the first subreport. For instance...

    Detail Band
    Subreport1
    Subreport2

    procedure TForm1.ppDetailBand1AfterPrint(Sender: TObject);
    begin
    if (ppChildReport1.Engine.PrintPosRect.Top > 150000) then
    ppSubreport2.KeepTogether := True
    else
    ppSubreport2.KeepTogether := False;
    end;

    Note that the PrintPosRect is calculated in microns. 150000 is a little
    less than 6 inches so if the first subreport extends beyond 6 inches on the
    last page, the second subreport will start printing on a new page.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.