Support Center

Using the document template editor

Use the document template editor to set up your document templates.

In this article, you can find out how to implement placeholders and add data into your documents.

Here is an example:

Hello, {{Customer.Name}}
{{#with Order}}
{{#if LineItems}}
Here is a summary of your previous order:
{{#each LineItems}}
{{ProductName}}: {{UnitPrice:C}} x {{Quantity}}
Your total was {{Total:C}}.
You do not have any recent purchases.

Most of the lines shown above would not appear in the final output. You can write templates for normal text, not just HTML/XML.


The placeholders can be any valid identifier. These map to the property names in your classes.

Formatting Placeholders

Each format item takes the following form and consists of the following components:


The matching braces are required. Notice that they are double curly braces. The alignment and the format strings are optional and match the syntax accepted by String.Format. Refer to String.Format's documentation to learn more about the standard and custom format strings. 

Format Specifier Name Example
"C" or "c" Currency

"C" 123.456 -> $123.46

"C3" 123.456 -> $123.456

"D" or "d" Decimal

"D" 12345 -> 12354

"D6" -123 -> -000123 

"F" or "f" Fixed-point

"F" 1234.5678 -> 1234.57

"F4" 1234.5678 -> 1234.5679

Placeholder Scope

The identifier is used to find a property with a matching name. If you want to print out the object itself, use the special identifier "this".

Some tags, such as each and with, change which object the values will be retrieved from.

If a property with the placeholder name can't be found at the current scope, the name will be searched for at the next highest level.

Nested Placeholders

If you want to grab a nested property, you can separate identifiers using ".".

The 'if' tag

The if tag allows you to conditionally include a block of text.

Hello{{#if Name}}, {{Name}}{{/if}}!!!

The block will be printed if:

  • The value is a non-empty string.
  • The value is a non-empty collection.
  • The value isn't the NUL char.
  • The value is a non-zero number.
  • The value evaluates to true.


The if tag has complimentary elif and else tags. There can be as many elif tags as desired but the else tag must appear only once and after all other tags.

The if tag has its counter-partner, "else" which can be used when the if tag is not true.

{{#if Male}}Mr.{{#elif Married}}Mrs.{{#else}}Ms.{{/if}}

The 'each' tag

If you need to print out a block of text for each item in a collection, use the "each" tag.

{{#each Customers}}
Hello, {{Name}}!!

Within the context of the each block, the scope changes to the current item. So, in the example above, "Name" would refer to a property in the "Customer" class.

Additionally, you can access the current index into the collection being enumerated using the "index" tag.

{{#each Items}}
<li class="list-item{{#index}}" value="{{Value}}">{{Description}}</li>

This will build an HTML list, building a list of items with Description and Value properties. Additionally, the index tag is used to create a CSS class with increasing numbers.

The 'with' tag

Within a block of text, you may refer to a same top-level placeholder over and over. You can cut down the amount of text by using the "with" tag.

{{#with Customer.Address}}
{{FirstName}} {{LastName}}
{{#if Line2}}
{{#if Line3}}
{{City}} {{State}}, {{ZipCode}}

Here, the Customer.Address property will be searched first for the placeholders. If a property cannot be found in the Address object, it will be searched for in the Customer object and on up.


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk