If condition in PDF XML

The following method can be used in advanced PDF for the “IF” statement.

Scenario: checking if the discount total is greater than zero and then only show the discount value

<#if record.discounttotal!=0 >
    <tr style="padding: 5px; font-weight:bold">
        <td width='60%'></td>
        <td></td>
        <td>${record.discounttotal@label}</td>
        <td>${record.discounttotal}</td>
    </tr>
</#if>

Scenario: checking if sublist has any content

<#if record.item?has_content>

Scenario: checking locale and setting style

        <#if .locale == "zh_CN">
        font-family: stsong, sans-serif;
        <#elseif .locale == "zh_TW">
        font-family: msung, sans-serif;
        <#elseif .locale == "ja_JP">
        font-family: heiseimin, sans-serif;
        <#elseif .locale == "ko_KR">
        font-family: hygothic, sans-serif;
        <#elseif .locale == "ru_RU">
        font-family: verdana;
        <#else>
        font-family: sans-serif;
    </#if>

Leave a comment

Your email address will not be published. Required fields are marked *