I am trying a hello world with Freemarker using xdocreport and put a condition in the docx file, but it does not work. I tried:

[#if name?has_content]
Sdfsdfsdf sdf sdf 
[/#if]

<#if name?has_content>
Sdfsdfsdf sdf sdf 
</#if>

[#if name??]
Sdfsdfsdf sdf sdf 
[/#if]

<#if name??>
Sdfsdfsdf sdf sdf 
</#if>

The replacing fields is working fine but not the conditional fields. The output is exactly the same as the input.

有帮助吗?

解决方案

Your problem comes from with your docx which doesn't use mergefield. You must use mergefield to write any Freemarker directive, otherwise MS Word will escape your directive with XML characters (and your Freemarker directive will not work like your problem).

Note you have already posted this question question at https://code.google.com/p/xdocreport/issues/detail?id=285

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top