我正在尝试使用tcpdf
生成pdf文件。 pdf将包含表格。当我将每个td
设置为具有自动宽度时,tcpdf
不会生成该文件。
首先,我在html
文件中创建了所有表,以确保一切都按预期工作。问题出现在第二个表格中,就像这样
<style>
...
.table {
border: 1px solid black;
border-collapse: collapse;
}
...
</style>
...
<table cellspacing="0">
<tr>
<td rowspan="2" scope="col" class="apartment_title">AI</td>
<td rowspan="2" scope="col" class="apartment_title">Full Name</td>
<td rowspan="2" scope="col" class="apartment_title">ΟΡΟΦΟΣ</td>
<td rowspan="2" scope="col" class="apartment_title">ΜΕΤΡΑ</td>
<td colspan="5" scope="colgroup" class="apartment_title">MM</td>
<td colspan="5" scope="colgroup" class="apartment_title">Amount</td>
<td rowspan="2" scope="col" class="apartment_title">Amount 2</td>
<td rowspan="2" scope="col" class="apartment_title">AI</td>
</tr>
<tr>
<td scope="col" class="apartment_title">1</td>
<td scope="col" class="apartment_title">2</td>
<td scope="col" class="apartment_title">3</td>
<td scope="col" class="apartment_title">4</td>
<td scope="col" class="apartment_title">5</td>
<td scope="col" class="apartment_title">1</td>
<td scope="col" class="apartment_title">2</td>
<td scope="col" class="apartment_title">3</td>
<td scope="col" class="apartment_title">4</td>
<td scope="col" class="apartment_title">5</td>
</tr>
<tr>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info"></td>
</tr>
<tr class="odd_rows">
<td scope="col" class="apartment_info">1</td>
<td scope="col" class="apartment_info">Some user</td>
<td scope="col" class="apartment_info">1</td>
<td scope="col" class="apartment_info">65.00</td>
<td scope="col" class="apartment_info">47.56</td>
<td scope="col" class="apartment_info">180.36</td>
<td scope="col" class="apartment_info">180.36</td>
<td scope="col" class="apartment_info">180.36</td>
<td scope="col" class="apartment_info">180.36</td>
<td scope="col" class="apartment_info">147.56</td>
<td scope="col" class="apartment_info">280.36</td>
<td scope="col" class="apartment_info">1380.36</td>
<td scope="col" class="apartment_info">40.36</td>
<td scope="col" class="apartment_info">80.36</td>
<td scope="col" class="apartment_info">230.00</td>
<td scope="col" class="apartment_info">1</td>
</tr>
<tr class="odd_rows">
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info">Total</td>
<td scope="col" class="apartment_info"></td>
<td scope="col" class="apartment_info">226.99</td>
<td scope="col" class="apartment_info">1000</td>
<td scope="col" class="apartment_info">1000</td>
<td scope="col" class="apartment_info">1000</td>
<td scope="col" class="apartment_info">1000</td>
<td scope="col" class="apartment_info">1000</td>
<td scope="col" class="apartment_info">247.56</td>
<td scope="col" class="apartment_info">480.36</td>
<td scope="col" class="apartment_info">3380.36</td>
<td scope="col" class="apartment_info">80.36</td>
<td scope="col" class="apartment_info">160.36</td>
<td scope="col" class="apartment_info">460.00</td>
<td scope="col" class="apartment_info"></td>
</tr>
</table>
我看到了这些示例,并且在每个td
上只有固定宽度,是否可以设置自动宽度?