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

Widow & Orphan Control in Richtext fields

edited August 2002 in General
I have a report that uses many TppRichText fields. Is there any way
to perform some widow/orphan control if the field breaks between
two pages?

I would like to force it to keep at least two lines of the richtext
field together if it is forced to break the field across pages.

I know about the keeptogether property, but I don't always want the entire
field to skip to the next page.

Thanks.

Bill

Comments

  • edited August 2002
    In other words your requirement is that when at least two lines cannot fit
    on the remainder of the page, only then carry the entire memo over. Though
    there is no direct way to tell it to do that, you can always take the
    approach of making this judgement on your own by looking at the space
    remaining on the page (use Report.Engine.PrintPosRect), and measuring the
    text on your own. The problem, of course, is that measuring RichText is
    trickier then measuring standard text. To circumvent that you can cut some
    corners with the following approach which should give you pretty predictable
    behavior. Estimate the average height of a line of RichText based on your
    font. If you use multiple fonts/sizes then create a lookup table ahead of
    time. Then, before printing the record containing the richtext you can make
    the same judgement as above and decide whether you want to force the entire
    richtext onto the next page at that point.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited August 2002
    Alexander,

    Thanks for your suggestion -- it's pointed me in the right
    direction but isn't exactly what I had in mind.
    I wasn't very clear in stating what I wanted.

    My client has described an "orphan" as the first line of a
    paragraph printed alone at the bottom of a page or the last
    line of a paragraph printed alone at the top of a page.

    What I would like to do is this:

    If an orphaned richtext line prints at the bottom of a page, then
    force the richtext to start on the next page.

    If an orphaned richtext line prints at the top of a page, then
    "borrow" a line of richtext from the previous page so that I can
    print two lines together at the top of the page to make the
    printout look better.

    I am in the process of creating a catalog from a database of richtext
    descriptions.

    The catalog used to be maintained staticly in a Microsoft Word file,
    where the user had a lot of formatting control. In Word, you can
    state that you want a certain number of lines of a paragraph kept
    together at all times, even if it means borrowing a line from a previous
    page.

    Am I crazy to attempt something like this in RB?

    Any chance some future implementation of the keeptogether property
    will allow you specify the number of lines to keep together instead
    of forcing the whole memo/richtext to appear on the next page?

    Thanks for your help.

    Bill


  • edited August 2002
    Yes DM, a real orphan and widow facility would be really useful. Clients do
    expect Word Processor document standard output. Unfortunately, though
    wonderful in many ways, RB does leave orphans on the page.

    Maybe on that future facilities list??
  • edited August 2002
    Good suggestions. We'll definately keep them in mind.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.