[BluePrint > Support > Template Tutorial > 2. Creating an Outlook-Style Template]
Tutorial 2. Creating an Outlook-Style template
Note. In order to make full use of this tutorial, it is essential to first install Blueprint for Outlook. Further details can be found on the 'Download' page
To explain the concepts with this tutorial, the following blueprint template example will be referenced: MESSAGE_OUTLOOK.htm
In the previous tutorial, we introduced the idea of the blueprint template. It described how message properties could be extracted from a message and placed into a HTML document through the use of the property tag, BPMessProp. However, the discussion so far has only provided a basic toolset for presenting your messages.
In this tutorial, we will expand the toolset and explain how the Blueprint engine can be used to easily create a Microsoft Outlook style print view of a message.
This tutorial will explain how to use the following features:
Using Tables and Hiding Fields
Specifying a List of Possible Values
1. Using Tables and Hiding Fields
In HTML, tables are used to improve the presentation of information by displaying them in a grid style. Blueprint uses this to allow all field names (e.g. To, CC) and field values (e.g. Blueprint Support) to be displayed in columns.
To understand this further, open the MESSAGE_OUTLOOK.htm template using a text editor (e.g. Notepad). This template has been designed to provide the look-and-feel of the print provided by Microsoft Outlook. The main sections of the template are defined using a number of tables. This tutorial will discuss these sections of the template.
(Note. By default Blueprint is only using HTML tables for field alignment. Therefore all tables presented in these templates do not contain any borders.)
The first table provides a single row used for providing the name of the recipient who actually received the message. The formatting of the table/row ensures that the text will be bold, and the table's bottom border is displayed (i.e. to provide a full page underline).
The second table provides the presentation of the standard properties for this template. After the TABLE tag, two column tags (<COL>) have been added. These are used to assist with the formatting of the row data within the table (In the template, the first column is formatted with bold text and will take up 30% of the row width). After the <COL> tags, the table rows are defined. To discuss this further, the following table row (TR) has been extracted:
This row is responsible for displaying any CC recipients within the printed message. The table row has been separated into two columns; the field name and value. The table data (TD) tags are used to add the data to each column of the row. As discussed previously, the first column will be presented in bold and will represent 30% of the table row.
The second column contains the special property tag, BPMessProp, and will therefore be processed by Blueprint. As before, the text contains the message property information; In this case, the CC recipient list will be added to the HTML document.However, in this example, a second piece of data has been added to the text; The key word, HIDE_ROW_IF_EMPTY *. When this tag is defined, Blueprint will determine whether the text (after processing) contains any data. If there is no data available, (e.g. there are no CC recipients defined in this message), all the HTML between the <TR> and the </TR> will not be displayed when the message is printed. In this above example, this therefore means the whole row containing the "Cc:" will not be displayed.
An extract of a printed message containing a CC recipient
An extract of a printed message with does not contain a CC recipient
tag becomes an essential tag for managing any properties within the message that should not be visible unless the property is present.
* Note. The Blueprint property information stored within the text tags can contain a number of special key words, providing a variety of features. When these key words are used together they are delimited using the '|' character. For a full list of key words and their behavior, please see the Technical Reference page.
2. Specifying a List of Possible Values
Most properties within Microsoft Outlook are managed as simple text (e.g. Subject). However, for some properties, it is better to manage the property using a numerical value, so that the text can be presented using the language that the machine is configured for. Blueprint for Outlook fully supports this idea. Within the BPMessProp tag text area, the following key word is provided: POSSIBLE_VALUES. To understand this further, the following section has been extracted from the MESSAGE_OUTLOOK.htm blueprint template:
<TD id="BPMessProp">NAME=FlagStatus|HIDE_TABLE_IF_EMPTY|POSSIBLE_VALUES=0: , 1:Completed, 2:Flagged</TD>
This row is responsible for presenting the Flag status of the message. Within the MESSAGE_OUTLOOK.htm document, a single table is defined to handle both the Flag Request (e.g. "Follow Up"), and the Flag status of the message. In this case, Outlook manages the Flag Request as simple text, and can be displayed as is. However, the FlagStatus is managed as a numerical value, within the range 0-2, where 0 indicates that the message does not have a flag status. Therefore, in the example above the POSSIBLE_VALUES keyword is defined as:
POSSIBLE_VALUES=<numeric value>:<text value>, ...
For example, if the flag status is 1, the printed value will be 'Completed'.
The 0 case above describes an interesting behavior; when the flag status contains 0, the replacement text will be " ". In this case, a new keyword is also present in the property information: HIDE_TABLE_IF_EMPTY. This keyword behaves similar to the HIDE_ROW_IF_EMPTY keyword, but instead of removing the current table row, the entire table is removed from the displayed print. Therefore, in this case, when the flag status of the message is none, the whole table responsible for displaying Flag information is not presented.
There are a number of other properties managed as numerical values. See the Technical Reference page
for further information. Also, see the custom template tutorial to see how to manage your own custom form numerical values.
An extract of a printed message with contains an Importance and a Sensitivity. Both of these properties are managed using a numeric value.
As you should now see, the template is a powerful tool for defining exactly how you want your printed messages to be presented. The ability to hide table elements from display depending on the properties within the message is a example of the intelligient behavior that is possible by using Blueprint for Outlook.
In addition, the possible-values processing allows you to have complete control over the text that is displayed for the numerical values. Blueprint for Outlook allows the ability to configure a different template depending on the regional settings (locale) of the local machine. Therefore, the Blueprint templates could be easily tailored to support a different language. You will have full control over the presentation of the printing template for that language, down to the text that is displayed for any numerical fields.
Continue to Tutorial 3: Working with Headers and Footers