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

ppDBText Size

edited June 2003 in General
Hello,

Prior to printing, I need to determine whether the field values for several
report objects will fit within the preset widths of the field objects.

I start out with: ppField.spBoundsRect.Right - ppField.spBoundsRect.Left
for the fieldobject size. That seems to work out just fine.

I then need to determine the space that the fieldvalue will occupy, and
compare the two, and apply a smaller font to the field object. This is
being done on before report print by assigning an onprint eventhandler to
selected fieldobjects.

My problem is in determining the space that the fieldvalue will occupy. It
works for several fields, but not all.

I hope I described what I need to do so it's understandable. Do you have
any suggestions to accomplish this? I appreciate your help.

--
Michael Malinowski
GIS Ltd.

Comments

  • edited June 2003
    Hi Michael,

    Below is a link to an example that changes the font size based on the given
    amount of space to print. Notice that on screen, some of the fields seem to
    overflow, but if you send the report to the printer, the sizing is correct.
    This is due to the difference between screen pixel accuracy and printer dpi
    accuracy.

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


    -----------------------------------------------------
    Article: Why Preview may not Match Printed Output
    -----------------------------------------------------

    ReportBuilder uses the Printer device context to perform all calculations
    required to generate the report pages. This includes measuring text,
    wrapping text, and calculating the vertical page space required by a
    stretchable component such as a memo.

    Using the Printer device context results in a very high degree of accuracy
    when printing to the printer. For report Preview, all page elements must be
    scaled back to the screen. A typical printer has a resolution of 600 pixels
    per inch (or more). A typical screen has 96 pixels per inch. Thus there is
    some loss of fidelity in rendering to the screen.

    For multi-line text such as memos, ReportBuilder sometimes shrinks the font
    size for the preview so that the rendered text can fit within the required
    vertical page space. Even when True Type fonts this is sometimes necessary.


    --
    Best Regards,

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