Lists in Templates - Bullets & Numbered
We create various types of lists in documents. You can design templates to include various types of Bullets or Numbered lists.
We can understand this through some examples -
Let us take an example where the names of employees are shown in Bullet lists.
The template design would be like this -
<<foreach [bullet in EmployeeNames]>><<[bullet.listFirstName]>> <<[bullet.listLastName]>>
<</foreach>>
The data for the template is -
{
"companyName":"PDF4me",
"EmployeeNames": [
{
"listFirstName": "Thomas",
"listLastName": "Baskin"
},
{
"listFirstName": "Jacob",
"listLastName": "Gregory"
},
{
"listFirstName": "John",
"listLastName": "Doe"
}
]
}
Numbered List - Instead of bullets if you give the syntax in a numbered list like below, then the list will be generated as a numbered list
Adding Multi-level List
Here we can take an example of creating a multi-level list of Managers and Associates in a company. Look at the following template design -
<<foreach [manager in employees]>> Manager: <<[manager.listFirstName]>> <<[bullet.listLastName]>>
<<foreach [associate in employee.associates]>> Associate: <<[associate.name]>>
<</foreach>><</foreach>>
The data for above template syntax -
{
"companyName": "PDF4me",
"employees": [
{
"listFirstName": "Christopher",
"listLastName": "Nolan",
"associates": [
{
"name": "Will Smith"
},
{
"name": "Barry Allen"
},
{
"name": "Oliver Queen"
}
]
},
{
"listFirstName": "Sarah",
"listLastName": "Parker"
},
{
"listFirstName": "Justin",
"listLastName": "Langer",
"colleagues": [
{
"name": "Brad Pitt"
},
{
"name": "John Smith"
}
]
}
]
}