2016-08-13 181 views
0

我正在爲樹枝水平填充表格並將此樹枝視圖轉換爲PDF。樹枝 - 用HTML2PDF水平填充表格

我成功地將它水平填充,但我仍然有一個令人討厭的問題:我的最後一頁PDF右邊有一條黑線。

這裏是在PDF問題的一個畫面:我認爲這是

<table align="center"> 
<thead> 
<tr> 
    <th>Numéro</th> 
    <th>Note</th> 
    <th>Classement</th> 
    <th class="espace"></th> 
    <th>Numéro</th> 
    <th>Note</th> 
    <th>Classement</th> 
</tr> 
</thead> 
<tbody> 
{% for passercolle in passercolles %} 

    {% if (loop.index is odd) or loop.first %} 
     <tr> 
    {% endif %} 

    {% if loop.index is odd %} 
     <td>{{ passercolle.username }}</td> 
     <td>{{ passercolle.note }}/20</td> 
     <td>{{ passercolle.classement }}</td> 
     <td class="espace" ></td> 
    {% elseif loop.index is even %} 
     <td>{{ passercolle.username }}</td> 
     <td>{{ passercolle.note }}/20</td> 
     <td>{{ passercolle.classement }}</td> 
    {% endif %} 

    {% if loop.last and loop.last is odd %} 
     <td></td> 
     <td></td> 
     <td></td> 
    {% endif %} 

    {% if (loop.index is even) or loop.last %} 
     </tr> 
    {% endif %} 

{% endfor %} 
</tbody> 
</table> 

PDF

在枝杈觀點:

Twig

這裏是我的代碼loop.last的問題b我解決不了這個問題。

回答

0

通過替代{% if loop.last and loop.last is odd %}解決{% if loop.last and passercolles|length is odd %}