0

我有一个入站货件保存的按集装箱列出的物品的搜索。我打印带有数量、描述等的物品清单没有问题,但是当我添加“船号”或“装运号”时,我不需要在每一行重复。我更愿意在 PDF 的顶部与每行显示我通常会“分组”的信息。

我应该注意,当我打印保存的搜索时,我已经将搜索过滤到一个容器,这意味着只有一个“装运号”和一个“船号”。

<table align="center" border=".5" cellpadding=".5" cellspacing=".5" class="NATIVE-TABLE" style="width:100%;"><#list results as result><#if result_index == 0>
<thead>
    <tr>
    <th align="center" scope="col" style="width: 107px;">
    <div><big>Shipment #</big></div>
    </th>
    <th align="center" scope="col" style="width: 103px;">
    <div><big>Status</big></div>
    </th>
    <th align="center" scope="col" style="width: 156px;">
    <div><big>Destination</big></div>
    </th>
    <th align="center" scope="col" style="width: 150px;">
    <div><big>Actual Ship Date</big></div>
    </th>
    <th align="center" scope="col" style="width: 154px;">
    <div><big>Expected Delivery Date</big></div>
    </th>
    <th align="center" scope="col">
    <div><big>Carrier</big></div>
    </th>
    <th align="center" scope="col">
    <div><big>Vessel #</big></div>
    </th>
    </tr>
</thead>
</#if><tr>
    <td align="center" style="width: 107px;">${result.shipmentnumber}</td>
    <td align="center" style="width: 103px;">${result.status}</td>
    <td align="center" style="width: 156px;">${result.custrecord142}</td>
    <td align="center" style="width: 150px;">${result.actualshippingdate}</td>
    <td align="center" style="width: 154px;">${result.expecteddeliverydate}</td>
    <td align="center" style="width: 154px;">${result.custrecord_htd_shipper_info}</td>
    <td align="center" style="width: 154px;">${result.vesselnumber}</td>
    </tr>
    </#list></table>
4

1 回答 1

2

首先:请发布您的代码,以便我们了解您的最新动态并做出相应的回应——这有助于我们为您提供帮助!

第二:一般模式是您只需使用第一个结果中的值来构成您的标题,然后遍历所有结果以提供您的行。它看起来像:

<#list results as result>
    <#if result_index == 0>
        *header information goes here*
    </#if>
        *line information goes here*
</#list>

编辑添加代码

<table align="center" border=".5" cellpadding=".5" cellspacing=".5" class="NATIVE-TABLE" style="width:100%;"><#list results as result><#if result_index == 0>
    <thead>
        <tr>
        <th align="center" scope="col" style="width: 107px;">
        <div><big>Shipment #</big></div>
        </th>
        <th align="center" scope="col" style="width: 103px;">
        <div><big>Status</big></div>
        </th>
        <th align="center" scope="col" style="width: 156px;">
        <div><big>Destination</big></div>
        </th>
        <th align="center" scope="col" style="width: 150px;">
        <div><big>Actual Ship Date</big></div>
        </th>
        <th align="center" scope="col" style="width: 154px;">
        <div><big>Expected Delivery Date</big></div>
        </th>
        <th align="center" scope="col">
        <div><big>Carrier</big></div>
        </th>
        <th align="center" scope="col">
        <div><big>Vessel #</big></div>
        </th>
        </tr>
    </thead>
    <tr>
        <td align="center" style="width: 107px;">${result.shipmentnumber}</td>
        <td align="center" style="width: 103px;">${result.status}</td>
        <td align="center" style="width: 156px;">${result.custrecord142}</td>
        <td align="center" style="width: 150px;">${result.actualshippingdate}</td>
        <td align="center" style="width: 154px;">${result.expecteddeliverydate}</td>
        <td align="center" style="width: 154px;">${result.custrecord_htd_shipper_info}</td>
        <td align="center" style="width: 154px;">${result.vesselnumber}</td>
        </tr>
    </#if>
        <tr>
        <td align="center" style="width: 107px;"></td>
        <td align="center" style="width: 103px;">${result.status}</td>
        <td align="center" style="width: 156px;">${result.custrecord142}</td>
        <td align="center" style="width: 150px;">${result.actualshippingdate}</td>
        <td align="center" style="width: 154px;">${result.expecteddeliverydate}</td>
        <td align="center" style="width: 154px;">${result.custrecord_htd_shipper_info}</td>
        <td align="center" style="width: 154px;"></td>
        </tr>
    </#list>
</table>
于 2020-04-11T00:33:39.430 回答