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

Forcing a page break....

edited January 2004 in General
Hi,

I'm trying to force a page break on demand. The intention is to
calculate the space that is needed in order to print the first detail
following a group header (including elements that might be displayed as
a subreport).

I read the Article "Forcing a Page Break" - but doing as advised
(setting a group to break on a static label and start a new page by
overriding it using OnGetBreakValue) results in always having a page
break before the first time the group is printed - even when I do not
override the static label at all.

So - how can I check before(!) a group is printed, whether I want a
page break, or not?

Kind regards,

Mark Meyer

Comments

  • edited January 2004
    Hi Mark,

    There are a couple of other ways to force a page break you might want to
    try.

    1. Try calling Band.OutOfSpace. The will tell the engine that a band has
    run out of space forcing a page break. Remember that pages are calculated
    on the first pass of a report so the page breaks must match if you are using
    a two pass report.

    2. Adding a Section Style subreport to your report will also cause a page
    break.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Hi,


    Okay - this works. But how to calculate?

    I thought about something like

    NeededHeight:=
    DetailBand.Height+CountSubElements*SubDetail.Height+SubSummary.Height;

    IF (Report.Height-Report.BottomBorder)-(NeededHeight)<0 THEN
    DetailBand.OutOfSpace;


    I can get the Height of the Bands - but how to get the borders and the
    pageheight - I mean those values that are set within "PageSettings"...?
  • edited January 2004
    Mark Meyer wrote:

    Okay - I 've found Report.PrinterSettings.MarginBottom, so it now reads

    NeededHeight:=
    DetailBand.Height+CountSubElements*SubDetail.Height+SubSummary.Height;

    // if poPortrait:
    Availiable:=
    Report.PrinterSettings.PaperHeight-Report.PrinterSettings.MarginBottom
    -DetailBand.CurrentPosition

    Unfortunately "CurrentPosition" has values like "167653" while the
    others seem to contain values corresponding to the report units (mm in
    my case).

    As CurrentPosition is not documented within the help-file, I can only
    guess - 1/10000 mm? Will this always be like that on every machine?

    Kind regards,

    Mark
  • edited January 2004
    Hi Mark,

    Yes, ReportBuilder makes and converts all measurements into microns or
    1/1000 mm before processing. There are some utility functions you can use
    in the ppUtils.pas file to make conversions on these numbers.

    Take a look at ppFromMMThousandths, and ppToMMThousandths.

    --
    Best Regards,

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