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

How to determine available free space on the actual page?

edited December 2005 in General
I'm working on an invoicing application.
After the last order item, I'd like to print an advertizing either as
a region or a sub-report (containing a RTF component).
We now habe different customer (of our software, not of the
end-customer getting that invoices) demands:
1. some say: always print the ad; that's fine
2. other say: only print the ad, if there is enough free space; don't
waste my company paper or increase my postage fees by beginning a new
page only for the ad.

So, how can I determine, that there is enough free space on the page
to fit for sub-report (or region)? I would then control the .visible
property with this check

Regards
Gunther

Comments

  • edited December 2005

    See my reply to your previous post about the group footer on every page. The
    downloadable example contains a method called CheckSpaceLeftOnPageForGroup
    that contains the calculation. Here is part of that calculation. Try to use
    the Band.BeforePrint event to check the space available and toggle the
    visibility of the object.

    var
    ldAvailableSpaceInInches: Double;
    liAvailableSpace: Integer;
    begin

    Result := False;

    // microns
    liAvailableSpace := ppReport1.PrinterSetup.PageDef.mmPrintableHeight -
    ppReport1.Engine.PrintPosRect.Top;

    // inches
    ldAvailableSpaceInInches := ppFromMMTHousandths(liAvailableSpace,
    utInches, pprtVertical, ppReport1.Printer);

    ldAvailableSpaceInInches := ldAvailableSpaceInInches -
    ppFooterband1.Height;





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.