New in 1.2.1 – Dynamic Master Pages


RPE Master Pages are the means through which template designers control the layout of the document for the Word and PDF output. There is one aspect with design of the master pages that makes them harder to use, their properties are static.

This limitation can be overcome by using multiple master pages and toggling the use of one or the other though a variable, essentially allowing a dynamic master page usage in the template. The fundamental problem with this approach is that it requires duplication of the master pages.

RPE 1.2.1 removes this limitation and allows master pages to be fully dynamic. The outline of the typical process to use dynamic master pages is provided below.

A typical scenario where this capability is needed is to change the orientation of the page based on the value of an attribute from the data source, without changing any other property of the master page.

Prior to 1.2.1 the solution was to create master pages with “landscape” and “portrait” orientations but that would otherwise be identical.

With RPE 1.2.1 the solution is described below. The example template, data and the Word output are available here.

  1. create the master page as needed
  2. create an internal variable that controls the page orientation, for example pageOrientation_
  3. use this variable in the master page definition for the orientation property ( this was not previously possible) dynmp_3
  4. use this master page on the element where you want the switch to occur ( also see point 8 below)
    dynmp_1
  5. Calculate the orientation as needed. In my example I switch the master page to Landscape every time I encounter an object with Priority mandatory and change back to Portrait when any other object is found.
    dynmp_2

With the above steps the switch will only occur for the first time due to how RPE implements the master page switch: RPE switches the master page only if its name is different from the current page OR the force page change value is set to true.

Considering the above and since now a single master page is used you need to explicitly tell RPE when to change the page. This is done in a similar manner to how the orientation is calculated:

  1. create an internal variable that controls the page change, name it forcePageChange_
  2. calculate the value of this variable in the same place where you calculate the orientation, in item 3 above. Set it to true when the orientation has to change from Portrait to landscape and viceversa
  3. Use this variable as the value for the “force page change” property on the element where you have used the master page, item 4 above
About these ads

One thought on “New in 1.2.1 – Dynamic Master Pages”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s