This article explains what the page setup setting is and provide examples of how it can be used with the binding syntax in smart templates.
Prerequisites
|
What is the page setup setting?
The page setup allows controlling the settings available in Word in Layout > Page Setup. These settings help adjust the general setup of the document such as the orientation, margins, width and height, and more. The Page Setup can be set statically by inputting a specific value or dynamically by using the binding syntax.
ImportantThe Page Setup setting is only available in Word and only supported with templates that are stored in the Document Library. |
How to set the page setup in a smart template
When building the template settings and properties, the Page Setup setting can be used to set the page layout configuration for the smart template, following the steps below:
- In Template Designer, open the Advanced tab.
- Click + Add property.
- In the Type field select Page Setup.
- The following fields are available:
-
Top/Right/Bottom/Left Margin: Enter a (static) value in centimeters like '2.54 cm' (without quotes), or use a (dynamic) binding like
{{UserProfile.PageFormat.TopMargin}}
if you want to retrieve the value from a data source. -
Gutter: Enter a (static) value in centimeters like '0 cm' (without quotes), or use a (dynamic) binding like
{{UserProfile.PageFormat.Gutter}}
if you want to retrieve the value from a data source. -
Gutter Position: expected to be either
{{GutterPosition.Left}}
or{{GutterPosition.Top}}
. -
Orientation: expected to be either
{{Orientation.Portrait}}
or{{Orientation.Landscape}}
. -
Paper Width/Height: Enter a (static) value in centimeters like '21 cm' (without quotes), or use a (dynamic) binding like
{{UserProfile.PageFormat.PaperWidth}}
if you want to retrieve the value from a data source. -
Header/Footer From Edge: Enter a (static) value in centimeters like '1.25 cm' (without quotes), or use a (dynamic) binding like
{{UserProfile.PageFormat.HeaderFromEdge}}
if you want to retrieve the value from a data source.
-
Top/Right/Bottom/Left Margin: Enter a (static) value in centimeters like '2.54 cm' (without quotes), or use a (dynamic) binding like
- Optional: set the additional setting Disable Updates. If this is enabled, no changes will be applied when the document content updater is used. By default it's disabled, allowing updates.
- Click Add to document.
Page Setup examples
Example 1
Using Page Setup to statically set a standard A4 page layout.
Top Margin | "2.54 cm" |
---|---|
Right Margin | "2.54 cm" |
Bottom Margin | "2.54 cm" |
Left Margin | "2.54 cm" |
Gutter | "0 cm" |
Gutter Position | {{GutterPosition.Left}} |
Orientation | {{Orientation.Portrait}} |
Paper Width | "21 cm" |
Paper Height | "29.7 cm" |
Header From Edge | "1.25 cm" |
Footer From Edge | "1.25 cm" |
Example 2
Using Page Setup to statically set a standard Letter (US) page layout.
Top Margin | "2.54 cm" |
---|---|
Right Margin | "2.54 cm" |
Bottom Margin | "2.54 cm" |
Left Margin | "2.54 cm" |
Gutter | "0 cm" |
Gutter Position | {{GutterPosition.Left}} |
Orientation | {{Orientation.Portrait}} |
Paper Width | "21.59 cm" |
Paper Height | "27.94 cm" |
Header From Edge | "1.25 cm" |
Footer From Edge | "1.25 cm" |
Example 3
Using Page Setup and the IfElse() function to dynamically set the page orientation based on the 'Orientation' dropdown question originating from the response form.
In this example this data source: is used:
- If 'Portrait' is chosen, the width will be set to 21 cm and the height to 29.7 cm.
- If 'Landscape' is chosen, the width will be set to 29.7 cm and the height to 21 cm.
Top Margin | "2.54 cm" |
---|---|
Right Margin | "2.54 cm" |
Bottom Margin | "2.54 cm" |
Left Margin | "2.54 cm" |
Gutter | "0 cm" |
Gutter Position | {{GutterPosition.Left}} |
Orientation | {{IfElse(Equals(Form.Orientation.Name, "Portrait"), Orientation.Portrait, Orientation.Landscape)}} |
Paper Width | {{Form.Orientation.PaperWidth}} |
Paper Height | {{Form.Orientation.PaperHeight}} |
Header From Edge | "1.25 cm" |
Footer From Edge | "1.25 cm" |
Example 4
You can set up a (blank) template to use a specific page format (like 'A4' or 'Letter') depending on e.g. the location set in the User Profile. For example if the office location is in the United States then the page format automatically is set to 'Letter' and when the office location is in The Netherlands the page format is set to 'A4'.
There are different ways to set this up, this is just one example. Follow the steps below:
- Create a data source named PageSetup and add a PaperWidth and PaperHeight column (both of Type Text). Then add the values as shown below:
Important
- Always use centimeters ("cm") as the unit of measurement.
- With values like '29.7' always use a decimal point as divider, not a comma.
- Create a data source named Countries, add a PaperFormat column of Type Reference and link it to PageSetup data source created in step 1. The result looks like this:
- Click Open data source, then click + Create.
- Type the value 'Netherlands' in the Name field and select 'A4' in the PaperFormat dropdown, then click Create:
- Repeat step 4 with the Name 'United States' and PaperFormat 'Letter'. The result looks like this:
- Create an Offices data source with a Country column of Type Reference and link it to the Countries data source created in step 5.
Optionally add columns like Address and City. The result looks like this:
- Next, in the User Profile create a Dropdown with the Name and Label 'Location' and link it to the Name column of the Offices data source. The result looks like this:
Optional: After the dropdown is created add the binding{{UserProfile.Location.Name}}
to the Profile summary field:
- Create a template. On the Advanced tab in Template Designer click + Add property, then in the Type field select Page Setup.
- In the PaperWidth field type this binding:
{{UserProfile.Location.Country.PaperFormat.PaperWidth}}
. - In the PaperHeight field type this binding:
{{UserProfile.Location.Country.PaperFormat.PaperHeight}}
. - The result looks like this:
Note
In this example only the fields Paper Width and Paper Height are used, but of course you can also create bindings for other fields like Top Margin, Left Margin and Orientation if you have created columns for these fields in the PageSetup data source from step 1.
- Click Add to document.
- Save the template and upload it to the Admin Center, for example as blank template (in the example 'Blank with page setup'):
- Now when a user located in the United States creates a blank document then the page format is automatically set to 'Letter':
When a user located in The Netherlands creates it then the page format is automatically set to 'A4':
Example 5
In example 4 the page format is set depending on the location, but it can also be done in a simpler way by asking the user which page format to use.
Setting up the User Profile and template works the same as in example 4, therefore a brief explanation in this example.
- Create a data source named PageSetup and add a PaperWidth and PaperHeight column (both of Type Text). Then add the values as shown below:
Important
- Always use centimeters ("cm") as the unit of measurement.
- With values like '29.7' always use a decimal point as divider, not a comma.
- In the User Profile create a Dropdown with the Name 'PageFormat' and Label 'Page format' and link it to the Name column of the PageSetup data source.
- Create a template. On the Advanced tab in Template Designer click + Add property, then in the Type field select Page Setup.
- In the PaperWidth field type this binding:
{{UserProfile.PageFormat.PaperWidth}}
. - In the PaperHeight field type this binding:
{{UserProfile.PageFormat.PaperHeight}}
. - Click Add to document.
- Save the template and upload it to the Admin Center, for example as blank document.
- In the User Profile the user can choose to use 'Letter' or 'A4' as the page format:
- When a user creates a document and in the User Profile the page format is set to 'Letter', then this is applied to the document.
If the page format in the User Profile is set to 'A4' then that page format is used:
Comments
Article is closed for comments.