Hi All,
Is there a way to hide a table using the docx from dynamic template when the table doesn't have any values ?
For example, in the attached docx template, I would like to hide the second table in case an empty dataset is passed to this table.
a!localVariables( local!data: { { name: "John Samuael", branch: "CSE", rollNum: "abc" }, { name: "Michelle Dsouza", branch: "IT", rollNum: "fgh" } }, local!addressData: { /*{*/ /*address: "1000 Main St",*/ /*city: "Houston",*/ /*state: "TX"*/ /*},*/ /*{*/ /*address: "900 Main St",*/ /*city: "Dallas",*/ /*state: "TX"*/ /*}*/ }, concat( "<details>", "<info>", a!forEach( items: local!data, expression: "<rowvalues name = " & "'" & fv!item.name & "'" & " branch= " & "'" & fv!item.branch & "'" & " rollNum= " & "'" & fv!item.rollNum & "'" & " />" ), "</info>", "<addressData>", a!forEach( items: local!addressData, expression: "<rowvalues address = " & "'" & fv!item.address & "'" & " city= " & "'" & fv!item.city & "'" & " state= " & "'" & fv!item.state & "'" & " />" ), "</addressData>", "</details>" ) )
0741.Dynamic Word Template.docx
Regards,
Sidd
Discussion posts and replies are publicly visible
Is there a way to achieve this ?
One way that springs to mind is to have TWO Docx templates, one with the table and one without, and dynamically choose the template you want to use based upon whether your dataset is empty.
Is there a way to handle this at the template level itself? I am trying to see if there's anything that can designed in the freemarker docx template, but have had no success, so far. Any pointers/suggestions would be helpful.