Inserting Blank Page(s)

edited October 2017 in FastReport VCL 5
Here is my situation:
My software prints giving statements for donors to an organization. The users want to duplex to save paper but standard duplex is not what is needed here as statements can be a single or multiple pages per unique donor.

For example in a single print for several selected donors, we have this situation:
Statement #1 has 2 pages, statement #2 has 3 pages, and statement #3 has 1 page that create a single 6 page print job. Each statement is for a different donor. If I print non-duplex you get what you expect. 6 page and no problems. If you print duplex, you get statements starting on the back side of another donors page. No good.

I've tried many different things and reviewed the events on the TfrxEngine and TfrxReport classes and have not been able to see a way to handle this situation or know when to insert a blank page. I don't even see an event to know when the report engine moves through the dataset when a key changes on the master to then attempt to insert blanks.

What I need to figure out is how to (while pages are being generated) to check if the current set of pages belong to a set of data, and then if the data has changed, insert a blank page conditional if the set of pages ends on an odd page. This will ensure the next set of pages for a next donor statement starts on the next sheet of paper when printed, and not the backside of the previous statement page.

For example:
Statement 1 would be pages 1 and 2;
- Pages 1 and 2 would have statement data, front/back on 1 sheet of paper.
Statement 2 would be pages 3,4,5, and 6;
- Pages 3,4,5 would be statement data, page 6 would be blank, across 2 sheets of paper.
Statement 3 would be page 7 and 8;
- Page 7 would be statement data and page 8 would be blank, on 1 sheet of paper.


Thanks for any suggestions, code examples, or prayers! [img]style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> Here are a few examples of that I've tried and what didn't work: I check the key values from my master dataset and when it changes from the previous value on "AfterScroll" I've tried: - TfrxReport.PreviewPages.AddEmptyPage(TfrxReport.PreviewPages.Count -1); This kinda works but the page is added before the last page in a set of pages. In a set of preview pages, I get the blank X,P,X,P where X is the blank. It should be P,X,P,X - TfrxReport.PreviewPages.AddEmptyPage(TfrxReport.PreviewPages.Count); Index out of bounds(#) exception is raised. Guess you can't add a page at the end of a set. Maybe FR VCL6 will support for "AppendEmptyPage" at the end of the set preview pages. I can see a way to achieve this right now.[/img]

Comments

  • gpigpi
    edited 8:02PM
    Try to prepare one page empty report
    frxReport1.LoadFromFile('OneEmptyPage.fr3');
    frxReport1.PrepareReport(False);
    or
    frxReport2.LoadFromFile('OneEmptyPage.fr3');
    frxReport2.PrepareReport(False);
    frxReport1.PreviewPages.AddFrom(frxReport2);
  • PolomintPolomint Australia
    edited 8:02PM
    G'day John,

    We went on a similar journey a while back.

    Have you looked at the following thread?

    http://www.fast-report.com/en/forum/?p=/discussion/14332

    The composite and page numbering stuff may not be of use to you, but I hope the "intentional blank pages for formatting reasons when duplex printing" info is of some help.

    Cheers, Paul
  • edited 8:02PM
    Thanks for the replies.

    I've done the chaining of different reports together in this fashion and that works great. This situation is a single fFR3 report with a complex master/detail /detail/detail datasets.

    The master dataset is a user selected list of individual donors. Could be just one or thousands. The detail datasets record counts range from 1 to virtual unlimited records that make any given individual statement span any number of pages.

    The problem is the need to insert the blank page between a set of donor pages when that "set of page" ends on an odd page. Fast Reports blows Rave reports out of the water but, in Rave I had a little more control to control this situation and I cannot see a set of engine or report object events that allow this particular control in FR.

    Again appreciate the replies! Take care!

    Thanks!
  • gpigpi
    edited 8:02PM
    Use Engine.NewPage to start new page during report's preparing

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.