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

Starting a letter on odd pages

edited February 2004 in General
Hi,

I have a report that prints a letter to customers. It includes a
sub report so I cannot be sure how many pages the letter will
be. I am printing on a duplex printer and I have been able to
set duplex mode so it prints back and front. The problem is
when it prints the next letter it may be on the back of the
last letter.

Is there a way to make the detail band alway start on an
odd page?

Thanks,
Joseph Gordon

Comments

  • edited February 2004
    Hi Joseph,

    My suggestion would be to create a group around every detail band then
    follow the directions in the article below to get each group header to start
    on an odd page.

    ------------------------------------------------------
    Article: Forcing Group Headers to Start on Odd Pages
    ------------------------------------------------------

    Question:

    I have a report that is printing duplexed
    and therefore I want to force the group headers to
    start on odd pages.

    Solution:

    Using demo report #71 do the following:

    1. Add a subreport to the GroupFooter band, just below the existing
    controls.

    2. Set the subreport's PrintBehavior property to pbSection - do not add any
    controls to the subreport - leave it blank.

    3. Add a Private field to the form: FPrintingSpacer: Boolean.

    4. Add an event handler for the FormCreate event with the following code:

    FPrintingSpacer := False;

    5. Add an event handler for the ppOrderDetailGroupFooterBand1BeforePrint
    event with the following code:

    if not FPrintingSpacer then
    begin
    ppSubReport1.Visible := odd(ppOrderDetail.AbsolutePageNo) and
    not ppOrderDetailGroupFooterBand1.Overflow;
    FPrintingSpacer := ppSubReport1.Visible;
    end
    else
    FPrintingSpacer := False;

    6. 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.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2004
    Hi,

    I did exactly as you instructed and it WORKED just fine. Thanks!!
    You people are great!

    I am a little confused though. I tried before to put just a
    sub report that was a pbsection on the detail band without putting
    in the group and putting in the BeforePrint of the band code
    to say only make it visible when we need a blank page between
    bands. This put 3 blank pages between each record. Could
    you explain if there is something special about putting it in the
    group footer and why you need the FPrinterSpacer?

    Thnks,
    Joseph Gordon


  • edited February 2004
    Joseph,

    Section style subreports are really meant to allow users to include numerous
    completed reports in one report object. Simply placing a section style
    subreport in a band with other objects tends to cause the report engine to
    get lost and can sometimes cause unexpected page breaks. By keeping the
    subreport in a band by itself, we are taking that situation away to ensure a
    clean generation.

    The reason we are using the FPrinterSpacer boolean variable is to globally
    keep track of the visibility of the subreport and to make the code easier to
    understand.

    --
    Best Regards,

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