Home RAP

How can I add a 'Region' based on how much space is left on page?

I have a report that requires multiple regions at the end of the report in the Summary section. The client wishes to have as many of these Regions added as long as there is sufficient space. As the Detail section can vary from one to 15 lines I need a way to calculate how much space is left, before I add the Regions, and then add as many Regions as possible without going over to a second page. So I need to know:

1) How to determine how much free space is remaining on a page.

2) Programatically add/enable Regions.

Can some one please help or provide some clues on how to achieve this please?

Best regards,

Bruce

Comments

  • Hi Bruce,

    1. Take a look at the following article on how to fill a page with lines. It uses a group footer to determine the end of the details and checks the PrintPosRect property for the page position in the AfterPrint event. It then uses that position and the Report.Engine.PageBottom to determine the space available.

    http://rbwiki.digital-metaphors.com/delphi-code/formatting-delphi-code/how-to-fill-a-page-with-lines/

    2. Instead drawing lines like in the example, you would then either create and add regions manually or simply set the proper regions' Visible property to true or false based on how much room you have.

    Best Regards,

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

    Many thanks for the ideas. I will investigate as this now provides me with a starting point - always the most difficult point to move to.

    Best regards,

    Bruce
Sign In or Register to comment.