BlazingDocs
Search…
Templates
Description of the templates syntax with samples.
For now, we support only DOCX (Microsoft Word) templates with a maximum 28MB size. You may manage merge templates in the Templates section of our Cloud Console, or send template content right in the request body. It's also possible to create template folders to organize the structure.
See the Samples section to download some example templates.
A typical template is composed of common document contents and tags that describe the template’s logic, structure, and bindings. It's not required to use Microsoft Word's Merge Fields at all, tags are simple text that you may format the same way as paragraphs for example.
<<tag [expression] -switch -switch>>
Particular tags can have additional elements. Some tags require closing counterparts. A closing tag has the “/” character that precedes its name. This tag’s name must match the name of the corresponding opening tag.
<</tag>>

Properties

Name is <<[Name]>>,
Works in <<[Company.Name]>>,
Email is <<[Email]>>

Date and Time

Most common date and time formats may be used in templates.
Format
Result
<<[Date]:"MM/dd/yyyy">>
05/29/2021
<<[Date]:"dddd, dd MMMM yyyy">>
Friday, 29 May 2021
<<[Date]:"yyyy MMMM">>
2021 May
<<[Date]:"MMMM dd">>
May 29
<<[Date]:"dddd, dd MMMM yyyy HH:mm">>
Friday, 29 May 2021 05:50
<<[Date]:"dddd, dd MMMM yyyy hh:mm tt">>
Friday, 29 May 2021 05:50 AM
<<[Date]:"dddd, dd MMMM yyyy HH:mm:ss">>
Friday, 29 May 2021 05:50:06
<<[Date]:"dddd, dd MMMM yyyy h:mm tt">>
Friday, 29 May 2021 5:50 AM
<<[Date]:"dddd, dd MMMM yyyy H:mm">>
Friday, 29 May 2021 5:50
<<[Date]:"MM/dd/yyyy HH:mm">>
05/29/2021 05:50
<<[Date]:"MM/dd/yyyy h:mm tt">>
05/29/2021 5:50 AM
<<[Date]:"MM/dd/yyyy HH:mm:ss">>
05/29/2021 05:50:06
<<[Date]:"MM/dd/yyyy hh:mm tt">>
05/29/2021 05:50 AM
<<[Date]:"MM/dd/yyyy H:mm">>
05/29/2021 5:50

Conditional blocks

You may use ==, !=, <, >,<> operators and null, true, false keywords.
<<if [!Items.Any()]>>
No items.
<<elseif [Items.Count() > 100]>>
Wow! A lot of items, thanks for purchase!
...
<<else>>
Thanks for purchase.
<</if>>
<<if [Name == null]>>
No name.
<<elseif [Company != null]>>
Name is <<[Name]>>, works in <<[Company.Name]>>.
<<else>>
Name is <<[Name]>>.
<</if>>

Collections

<<foreach [in Persons]>>
Name is <<[Name]>>, email is <<[Email]>>
<</foreach>>
<<foreach [person in Persons]>>
Name is <<[person.Name]>>, email is <<[person.Email]>>
<</foreach>>

Building tables

Title
Unit Price
Quantity
Total
<<foreach [in Items]>><<[Title]>>
<<[UnitPrice]>>
<<[Quantity]>>
<<[Total]>><</foreach>>

Images

You can insert images to your documents dynamically with image tag. To declare a dynamically inserted image within your template, do the following steps:
  1. 1.
    Add a textbox to your template at the place where you want to see an image.
  2. 2.
    Set common image attributes such as size, borders for the textbox, making the textbox look like a blank inserted image.
  3. 3.
    Specify an image tag within the textbox using the following syntax.
<<image [Photo.Url]>>
The expression may be an URL or base64 string.
By default, image stretches to fill a textbox without preserving the ratio. However, you can change this behavior like this:
<<image [Photo.Url] -keepRatio>>

Barcodes, QR codes

You may want to generate a barcode or QR code for your document. In this case, you may use QR and BC extensions for the image tag. We support UPCA, EAN13, CODE128, CODE39 barcode types to cover most of the business needs.
<<image [QR.Q(String)]>>
<<image [BC.UPCA(String)]>>
<<image [BC.EAN13(String)]>>
<<image [BC.CODE128(String)]>>
<<image [BC.CODE39(String)]>>

Links

<<link [Company.Website]>>
Copy link
On this page
Properties
Date and Time
Conditional blocks
Collections
Building tables
Images
Barcodes, QR codes
Links