【问题标题】:How can I insert tab in list items with Freemarker如何使用 Freemarker 在列表项中插入选项卡
【发布时间】:2021-12-06 11:03:27
【问题描述】:

我正在使用 Freemarker 生成 pdf 文档。我需要在列表项之间的列表中插入标签。我的资源是 JSON 文件。 我正在使用 right_pad 功能,但它似乎没有做任何事情。知道怎么做吗?

<#list data.house as house>
    <br>${"House name:"?right_pad(125)} ${house.name!}</br>
        <#list data.properties as properties>
            <br>${"Value:"?right_pad(125)} ${properties.value!} HUF</br>
            <br>${"Bank account number:"?right_pad(125)} ${properties.bankAccountNumber!}</br>
</#list>

【问题讨论】:

    标签: freemarker


    【解决方案1】:

    right_pad 内置函数在字符串末尾添加空格,但 your browser don't display these whitespaces

    一种解决方案是使用 CSS 来布局您的信息。有几种方法可以做到,这里是其中之一:

    <html>
    <head>
        <style>
            span{float: left; width: 200px;}
        </style>
    </head>
    <body>
    <#list data.house as house>
        <span>House name:</span>${house.name!}<br />
    </#list>
    </body>
    </html>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-07
      • 2016-06-01
      • 1970-01-01
      • 2019-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多