我发现google和stackoverflow中有很多相关内容,但它对我的结果没有影响。 我的数据超过40000行,我想要打印自动下一页并修复数据中断行。
并为每个页面设置页码。
<table cellspacing="0" class="table table_print" border="1">
<thead>
<tr>
<th>Num</tr>
<th>Name</th>
<th>Address</th>
<th>Contact</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2" scope="rowgroup"><?php echo $i; ?></td>
<td rowspan="2" scope="rowgroup"><?php echo $name; ?></td>
<td rowspan="2" scope="rowgroup"><?php echo $address; ?></td>
<td rowspan="2" scope="rowgroup"><?php echo $contact; ?></td>
<td scope="row"><?php echo $data[$i]['jan_price']; ?></td>
<td scope="row"><?php echo $data[$i]['feb_price']; ?></td>
<td scope="row"><?php echo $data[$i]['mar_price']; ?></td>
<td scope="row"><?php echo $data[$i]['apr_price']; ?></td>
<td scope="row"><?php echo $data[$i]['may_price']; ?></td>
<td scope="row"><?php echo $data[$i]['jun_price']; ?></td>
<td scope="row"><?php echo $data[$i]['jul_price']; ?></td>
<td scope="row"><?php echo $data[$i]['aug_price']; ?></td>
<td scope="row"><?php echo $data[$i]['sep_price']; ?></td>
<td scope="row"><?php echo $data[$i]['oct_price']; ?></td>
<td scope="row"><?php echo $data[$i]['nov_price']; ?></td>
<td scope="row"><?php echo $data[$i]['des_price']; ?></td>
</tr>
<tr>
<td scope="row"><?php echo $data[$i]['jan_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['feb_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['mar_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['apr_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['may_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['jun_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['jul_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['aug_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['sep_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['oct_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['nov_grand']; ?></td>
<td scope="row"><?php echo $data[$i]['des_grand']; ?></td>
</tr>
</tbody>
</table>
我用page-break-after: always;
page-break-inside: avoid;
page-break-before: avoid;
但它不起作用。
答案 0 :(得分:0)
对于遇到与我相同问题的人,我通过设置限制行每页打印来解决它
.table_print tbody tr:nth-of-type(32n){page-break-after: always;}