How To…PageBreak when X Space Left

Question

“How can I force a page break when less than X amount of space left?”

Solution

For simple layouts, use the DetailBand.PrintCount property to limit the number of times a static height detail band prints on each page.

For layouts with dynamic height detail, this example shows how to use the DetailBand BeforePrint event to calculate the amount of space left on the page.

Download: PageBreakXSpaceLeft.zip

Sample Delphi code: