The invoice template below is an example taken from the Template Library. It illustrates how a template document can use several elements, such as tables (with and without borders and coloring), groups of repeating data, calculations, conditional statements, and other field formatting to produce a seamless and customized invoice at merge time.
|1||A page header. Each page can have its own header or you can repeat headers across pages.|
A borderless table containing the account information. You can apply text formatting, such as colors, font sizes, and so on, to any template text.
The Total Amount Due also has a Word field formatting picture switch to display the amount as currency. [details]
|3||The TableGroup field will group like data. In this case, a table of repeating data will appear for each product family listed in the invoice. [details]|
|4||This table row will repeat to display each returned row of data that the solution report or query gathered. Repeating data sections begin with a TableStart field, and end with a TableEnd field. [details]
Repeating information is not confined to a table. You can place detail items directly on a page, to create a list, for example. [details]
|5||Calculation fields that subtotal the quantity and total price line items in the table above. [details]|
|6||Although this is a summary field of the entire invoice amount, the content comes directly from a Salesforce data field and is not calculated on the template.|
|7||A conditional statement (IF statement) that checks whether the invoice total is over a specified amount and, if so, to add text related to free shipping. This text does not appear for invoices where the total is below the specified amount. [details] This is an example only. Do NOT use double brackets with IF statements.|
|8||The page footer repeats across pages.|
When merged, the placeholder merge fields are replaced with data from the Salesforce record. This merged template appears as below: