Loops - Lists, Repeat Sections

Loops play a very important role in document generation. We use them to populate multiple line items in invoices, list conditions in contracts, etc. Following tutorial describes how to go about loops creation.

If you are familiar with the table population, then you already used loops. We loop over the JSON/XML/Excel data to populate table rows.




{#Job} {Role}


{Address} {/Job}

{#tagName}{/tagName} is the syntax for loops.

Notice {#Job} {/Job} tags. With following JSON, EDocGen loops over the array to populate two rows into the Job table.

[ {
"Enter_Name": "Steve",
"Enter_Email": "                                                                                                            Steve@mail.com",
"Job": {
"Role": "Engineer",
"Company": "Cisco",
"Address": "SanJose"
"Job": {
"Role": "Engineer",
"Company": "Microsoft",
"Address": "Seattle"

Similarly, you can use the loops to create lists, bullets, and pages etc.  Please see the template below.


With EDocGen, you can easily create lists and it's very similar to loops. Let's assume you've a JSON in following format.

  "Sample": [value1, value 2,value 3]


And you want to create list like

  • value1
  • value2
  • value3

You just need to include following loop in your template to create this list.


  •   {.}


EDocGen loop over the array to extract each of the values and present in a bullet format. 

Similarly you can create lists with Excel and XML data

In the above template,  observe tags for list  creation.


  • {ExampleSentense}


Please refer to the attached JSON array that populates this.

"ExampleSentences": ["Sentence 1", "Sentence 2", "Sentence3"]



Repeat Sections

You can use the englishsample.json file to create multiple pages of the above template. It produces a section for each noun.

Nested Bullets/Lists

Below is the syntax of tags for nested lists creation.


  • state:{state}






The corresponding JSON for it is


 "states": [{

 "state": "state1",

 "cities": ["City1", "City2", "City3"]

 }, {

 "state": "state2",

 "cities": ["1", "2", "3"]