字符串:

${value?if_exists}

 

判断:

<#if "${value}"=="是">
<w:t>是</w:t>
<#elseif "${value}"=="否">
  <w:t>否</w:t>
<#else>
<w:t></w:t>
</#if>
或者:
<#if "${value}"?contains("是/否")>
<w:t>是</w:t>
<#else>
<w:t>否</w:t>
</#if>

判断对象是否不为空
<#if ${name}??>
  ${name}
<#else>
  {默认值}
</#if>

判断对象属性是否不为空
<#if ${object.name}??>
  ${name}
<#else>
  {默认值}
</#if>

Boolean类型的判断
${checkedValue?string("true","false")}


assign定义变量:
<#assign pt1 = false>
<#list projectType as ptype>
<#if "${ptype}"=="1">
<#assign pt1 = true>
<w:t>☑</w:t>
</#if>
</#list>
<#if pt1==false>
<w:t>□</w:t>
</#if>

集合:
<#if valueList?? && (valueList?size > 0)>
  <#list valueList as value>
    ${value.属性}
  </#list>
</#if>

运算符:
== (等于),!= (不等于),gt(大于),gte(大于或者等于),lt(小于),lte(小于或者等于)。不建议用 >,<  可能会报错!

替换数据中的某些特殊字符
<w:t>${value?if_exists?replace(">","大于")?replace("<","小于")}</w:t>
 



相关文章:

  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2021-12-25
  • 2022-01-17
相关资源
相似解决方案