Using FreeMarker macro in XDocReport

327 Views Asked by At

I am trying to use a simple freemarker macro in an XDocReport, but I couldn't find a way to add and call it.

<#macro address company>
  <#if company.name??>${company.name}</#if>
  <#if company.address??>${company.address}</#if>
</#macro>
2

There are 2 best solutions below

0
On

Should be:

<@address company=c />

where c is your company object

0
On

You need to add MergeField (which has limit, you can divided in 2 fields) with text:

[#macro address company]
  [#if company.name??]${company.name}[/#if]
  [#if company.address??]${company.address}[/#if]
[/#macro]

And separated MergeField to call it (quotes,square brackets are important):

"[@address company=c1]"