请查看随附的打印格式以供参考。我正在使用jinja创建打印格式。如果内容很小,打印将有大量不需要的空间。我可以根据页面动态增加表格中最后一行的空间使用html和css。
请查找没有任何CSS的表格的代码示例。
<table class="table table-condensed table-hover table-bordered" style="font-size:13px;font-family: Arial, Helvetica, sans-serif;">
<tr>
<th>Sl.</th>
<th>Description</th>
<th class="text-right">Qty</th>
<th class="text-right">Unit Price</th>
<th class="text-right">Amount</th>
</tr>
{%- for row in doc.items -%}
<tr>
<td style="width: 2%;">{{ row.idx }}</td>
<td style="width: 73%;">{{ row.description_for_print or '' }}</td>
<td style="width: 2%; text-align: right;">{{ row.qty }}</td>
<td style="width: 13%; text-align: right;">
{{ row.get_formatted("rate", doc) or ''}}
<td style="width: 10%; text-align: right;">{{
row.get_formatted("amount", doc) or ''}}</td>
</tr>
{%- endfor -%}
{%- if doc.discount_amount -%}
<tr>
<td colspan="4">
<div class="row">
<div class="col-xs-12 text-left"><b>Total          :</b></div>
</div>
</td>
<td style="width: 8%; text-align: right;"><b>{{ doc.get_formatted("total") or '' }} </b></td>
</tr>
<tr>
<td colspan="4">
<div class="row">
<div class="col-xs-12 text-left"><b>Discount :</b></div>
</div>
</td>
<td style="width: 8%; text-align: right;"><b>{{ doc.get_formatted("discount_amount") or '' }} </b></td>
</tr>
{%- endif -%}
<tr>
<td colspan="4">
<div class="row">
<div class="col-xs-12 text-left"><b>Net Total : {{ doc.base_in_words or '' }}</b></div>
</div>
<td style="width: 8%; text-align: right;"><b>{{ doc.get_formatted("grand_total") or '' }} </b></td>
</tr>
<tr>
<td colspan="4">
<div class="row">
<div class="col-xs-12 text-left"><b>50% Down Payment : {{ frappe.utils.money_in_words(x) or ''}}</b></div>
</div>
</td>
<td style="width: 8%; text-align: right;"><b>{{ "{:,.2f}".format(x) or 0.00 }} </b></td>
</tr>
<tr>
<td colspan="4">
<div class="row">
<div class="col-xs-12 text-left"><b>50% Upon Delivery : {{ frappe.utils.money_in_words(x) or ''}}</b></div>
</div>
</td>
<td style="width: 8%; text-align: right;"><b>{{ "{:,.2f}".format(x) or 0.00 }} </b></td>
</tr>
</tbody>
</table>