Tables

The Encodian population engine enables JSON data to be easily added to tables within your word document.

This article provides detailed examples for creating the following types of tables:

Table - Simple

Table - Single Column

Table - Total

Table - Span Rows

Table - Simple

Example Document: Encodian - Template Syntax - Table Simple.docx

Example JSON Data:

{
"companyName": "Encodian",
"contracts": [
{
"customerName": "Microsoft",
"value": 100000,
"expires": "13/06/2021"
},
{
"customerName": "Encodian",
"value": 6872500,
"expires": "18/02/2029"
},
{
"customerName": "Heritage",
"value": 13549,
"expires": "6/12/2025"
}
]
}

Configure the table within your word document and then populate it as follows to add the relevant JSON properties to each column:

Column 1: <<foreach [contract in contracts]>><<[contract.customerName]>>
Column 2: <<[contract.expires]:"yyyy.MM.dd">>
Column 3: <<[contract.value]>><</foreach>>

mceclip0.png

This generates the following output:

mceclip1.png

Table - Single Column

Example Document: Encodian - Template Syntax - Table Single Column.docx

Example JSON Data:

{
"companyName": "Encodian",
"contracts": [
{
"customerName": "Microsoft",
"value": 100000,
"expires": "13/06/2021"
},
{
"customerName": "Encodian",
"value": 6872500,
"expires": "18/02/2029"
},
{
"customerName": "Heritage",
"value": 13549,
"expires": "6/12/2025"
}
]
}

Configure the table within your word document and then populate it as follows to add the relevant JSON properties to each column:

Row 1 > Column 1: <<foreach [contract in contracts]>>Customer: <<[contract.customerName]>>, Contract Date:<<[contract.expires]:"yyyy.MM.dd">>, Value: £<<[contract.value]>><</foreach -greedy>>

mceclip2.png

This generates the following output:

mceclip3.png

NOTE: the -greedy switch instructs the population engine to treat the property as a single row, if this is not used the output would be as follows:

mceclip5.png

Table - Total

Example Document: Encodian - Template Syntax - Table Totals.docx

Example JSON Data:

{
"companyName": "Encodian",
"contracts": [
{
"customerName": "Microsoft",
"value": 100000,
"expires": "13/06/2021"
},
{
"customerName": "Encodian",
"value": 6872500,
"expires": "18/02/2029"
},
{
"customerName": "Heritage",
"value": 13549,
"expires": "6/12/2025"
}
]
}

Configure the table within your word document and then populate it as follows to add the relevant JSON properties to each column:

Row 1 > Column 1: <<foreach [contract in contracts]>><<[contract.customerName]>>
Row 1 > Column 2: <<[contract.expires]:"yyyy.MM.dd">>
Row 1 > Column 3: £<<[contract.value]>><</foreach>>
Row 2 - Column 1: £<<[contracts.Sum(c =>c.value)]>>

mceclip3.png

This generates the following output:

mceclip4.png

Table - Span Rows

Example Document: Encodian - Template Syntax - Table Span Rows.docx

Example JSON Data:

{
"companyName": "Encodian",
"contracts": [
{
"customerName": "Microsoft",
"value": 100000,
"expires": "13/06/2021"
},
{
"customerName": "Encodian",
"value": 6872500,
"expires": "18/02/2029"
},
{
"customerName": "Heritage",
"value": 13549,
"expires": "6/12/2025"
}
]
}

Configure the table within your word document and then populate as follows to add the relevant JSON properties to each column:

Row 1 > Column 1: <<foreach [contract in contracts]>><<[contract.customerName]>>
Row 1 > Column 2: <<[contract.expires]:"yyyy.MM.dd">>
Row 2 > Column 1: £Value: £<<[contract.value]>>
Row 2 > Column 2: <</foreach -greedy>>

NOTE: the -greedy switch instructs the population engine to treat the property as a single row

mceclip0.png

This generates the following output:

mceclip1.png

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk