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 1
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 4 and 6 and type the answer here:
  • Post
  • Page Break menu is disabled when my cursor inside the section.

Page 1 of 1 (1 items)