Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

Having more control over Page Breaks using Conditional Formatting

Having more control over Page Breaks using Conditional Formatting

  • Comments 3
When printing forms, sometimes it might be desired to have more control over where Page Breaks should occur. For example, you might want a Repeating Table to start printing on a new page once it has reached a certain number of rows or you might wish to provide a way for users who are filling out forms to be able to insert/remove Page Breaks in certain locations of the form. You can accomplish this using Page Breaks (available with SP1) with Conditional Formatting.
 
Example 1: Allow users to insert a Page Break when a Checkbox is checked
  1. In Design mode, insert a Checkbox Control, type "Insert Page Break" next to the checkbox.
  2. Insert a Section Control (From the Control Task Pane, click on "Section")
  3. Within the Section Control, insert a Page Break (Place the cursor inside of the Section Control you just inserted and from the menu Insert | Page Break)
  4. Double click on the Section Control to open the Section Properties dialog. Select the Display tab and click on the Conditional Formatting button.
  5. Click  Add... to set a new condition, which will keep the Page Break "hidden" unless the checkbox is checked, to do this: Select the name of the checkbox in the first condition drop-down and set the condition "is equal to FALSE". Check the "Hide this Control" checkbox and close all open dialogs by clicking "Ok"
  6. You can test your form by clicking on the Preview Form button, in the toolbar.
Example 2: Start printing a Repeating Table in a new page once it has more than 3 rows
  1. In Design mode, insert a Section Control (From the Control Task Pane, click on "Section")
  2. Within the Section Control, insert a Page Break (Place the cursor inside of the Section Control you just inserted and from the menu Insert | Page Break)
  3. Place the mouse cursor beneath the Section Control and insert a Repeating Table (From the Control Task Pane, click on Repeating Table).
  4. Double click on the Section Control to open the Section Properties dialog. Select the Display tab and click on the Conditional Formatting button.
  5. Click Add... to set a new condition, which will keep the Page Break "hidden" unless the number of rows in the "Repeating Section" exceeds 3, to do this: Select  "The expression" in the first condition drop-down and type the following XPath expression referring to the Repeating Table, "count(../my:group2/my:group3) <=3" in the text field next to it. Check the "Hide this Control" checkbox and close all open dialogs by clicking "Ok"
  6. You can test your form by clicking on the Preview Form button, in the toolbar.
 
Leave a Comment
  • Please add 1 and 6 and type the answer here:
  • Post
  • Page Break menu is disabled when my cursor inside the section.

  • These instructions came from an Infopath Team Member? As stated on the previous comment (2 years ago), you are unable to insert a page break when cursor is on the the page template.  The cursor must be off the page in the gray area.  Is there some secret I don't know, because if these steps work it would truly help me out.

  • Hi CJ,

    I am not sure I follow - here is what I just tested moments ago:

    - Launched InfoPath Designer

    - Clicked "Blank Form" in the "Popular Form Templates" section

    - Clicked the "Design Form" button

    - Placed my cursor "below" the existing table that is there

    - From the controls box, added a Section control

    - Clicked in the Section so my cursor was flashing

    - From the Insert tab, chose Page Break

    What is key is that you either delete the existing table that is there by default or place your section/cursor below that table. Apparently this table is in a special class where a page break cannot be added.

    Scott

Page 1 of 1 (3 items)