Closed SimonSapin closed 11 years ago
Hi. Is there a way to turn off repeating <thead>
and <tfoot>
on every page?
@mzu Repeating on every page is the only real difference <thead>
and <tfoot>
have with <tbody>
, so you could just use <tbody>
. Or, if you’d rather not change the markup for some reason, use the following CSS:
thead, tfoot { display: table-row-group }
@SimonSapin Great, thanks.
@mzu how did you show/ repeat headers and footers on each page??
Sorry to necropost, I've had to remind myself of this multiple times, so to answer @NailaAkbar00 's question:
If you want table headers to repeat, it's sufficient to wrap the rows you wish to repeat in a thead tag.
<!-- Contents of thead is repeated on every page by Weasyprint. -->
<!-- Default CSS includes: -->
<!-- thead { display: table-header-group; } -->
<table>
<thead>
<tr>
<th>Country</th><th>Capital</th>
</tr>
</thead>
<tbody>
<tr>
<td>France</td><td>Paris</td>
</tr>
<tr>
<td>Germany</td><td>Berlin</td>
</tr>
<tr>
<td>Italy</td><td>Rome</td>
</tr>
</tbody>
</table>
<!-- If for some reason, you don't want thead to be repeated on every page, you can use the following CSS rule: -->
<!-- thead { display: table-row-group; } -->
This shows how Weasyprint behaves: http://test.weasyprint.org/suite-css21/chapter17/section2/test35/
Table border collapsing is annoying to do when header and footer row groups are repeated on every page. We should still do it. Later.
https://github.com/Kozea/WeasyPrint/blob/v0.19/weasyprint/formatting_structure/build.py#L507