Question: “I have a report that is printing duplexed and therefore I want to force the group headers to
start on odd pages.”
Using demo report #71 do the following:
- Add a subreport to the GroupFooter band, just below the existing controls.
- Set the subreport’s PrintBehavior property to pbSection – do not add any controls to the subreport – leave it blank.
- Add a Private field to the form: FPrintingSpacer: Boolean.
- Add an event handler for the FormCreate event with the following code:
Delphi/Pascal1FPrintingSpacer := False;
- Add an event handler for the ppOrderDetailGroupFooterBand1BeforePrint event with the following code:
Delphi/Pascal12345678if not FPrintingSpacer thenbeginppSubReport1.Visible := odd(ppOrderDetail.AbsolutePageNo) andnot ppOrderDetailGroupFooterBand1.Overflow;FPrintingSpacer := ppSubReport1.Visible;endelseFPrintingSpacer := False;
- Run the project and view report #71.Note that when a group is to start, it will only start on an odd page.
Caveats: We are brute-forcing this solution by causing the even numbered page to be taken up by the section style subreport. As a result, any page headers or footers you have in the main report will not appear on the even pages that are blank. To get around this, you could add identical header/footers or custom header/footers with only page numbers, or some such.