[英]How to add TABLE style in QWEB reports? Odoo 14
我想為表格添加邊框,
<table style="border: 1pt solid black;display: inline-block;">
<tbody style="">
<tr>
<th" >Title1</th>
<th" >Title2</th>
</tr>
<tr>
<td t-esc=""/>
<td t-esc=""/>
</tr>
</tbody>
</table>
但是當我嘗試添加這種樣式時:
<style>
td, th{border:solid 1px;text-align:center;}
</style>
請問有什么幫助嗎? 謝謝。
我嘗試了這兩種解決方案,但得到了以下結果:
<table class="table">
<tbody style="">
<tr>
<th >Title1</th>
<th >Title2</th>
</tr>
<tr>
<td > Field1 </td>
<td > Field2 </td>
</tr>
</tbody>
</table>
<table style=" border-collapse: collapse;">
<tbody >
<tr>
<th style=" border-collapse: collapse;" >Title1</th>
<th style=" border-collapse: collapse;" >Title2</th>
</tr>
<tr>
<td style=" border-collapse: collapse;" > Field1 </td>
<td style=" border-collapse: collapse;" > Field2 </td>
</tr>
</tbody>
您需要使用額外的 css 屬性,如下所示:
table, td, th{
border-collapse: collapse;
}
順便說一句,在 Odoo 中,引導程序已包含在內,因此您可以執行以下操作:
<table class="table">
<table>
所以你的最終代碼是
<!-- using bootstrap -->
<table class="table table-bordered ">
<tbody>
<tr>
<th>Title1</th>
<th>Title2</th>
</tr>
<tr>
<td> Field1 </td>
<td> Field2 </td>
</tr>
</tbody>
</table>
<!-- hard-coded style -->
<table style="border:solid 1px; border-collapse: collapse;">
<tbody>
<tr>
<th style="border:solid 1px; border-collapse: collapse;">Title1</th>
<th style="border:solid 1px; border-collapse: collapse;">Title2</th>
</tr>
<tr>
<td style="border:solid 1px; border-collapse: collapse;"> Field1</td>
<td style="border:solid 1px; border-collapse: collapse;"> Field2</td>
</tr>
</tbody>
</table>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.