Hi! Am I able to do something that doesn't break a table's rows across two pages? Am I also able to repeat table headers if the table goes to another page?
Thanks!
Table breaks and repeating headers
-
- Sr. Propeller Head
- Posts: 247
- Joined: Thu May 24, 2018 3:11 pm
- Location: Queensland, Australia
Re: Table breaks and repeating headers
As far as keeping a table all on the same page, the only way I know of doing this is to use a DIV around the table. I have a default style defined that I can use wherever I don't want stuff to break across columns or pages:
.keeptogether {
page-break-inside: avoid;
column-break-inside: avoid;
}
Then, just wrapping your content (or table) in a <div class="keeptogether"></div> will hold it to the same text frame - provided that it physically can fit in that text frame. If it's bigger than the frame you can't avoid the break.
To get headers and footers to repeat across tables, they need to be defined as headers and footers in the table. Right click the table and choose Table Properties. Make sure you've added a Header row in the Table Size section. You'll need to style the header row separately to the normal rows. In the xml your table will then look like:
Cheers,
Rob
.keeptogether {
page-break-inside: avoid;
column-break-inside: avoid;
}
Then, just wrapping your content (or table) in a <div class="keeptogether"></div> will hold it to the same text frame - provided that it physically can fit in that text frame. If it's bigger than the frame you can't avoid the break.
To get headers and footers to repeat across tables, they need to be defined as headers and footers in the table. Right click the table and choose Table Properties. Make sure you've added a Header row in the Table Size section. You'll need to style the header row separately to the normal rows. In the xml your table will then look like:
Code: Select all
<table>
<thead>
<tr><th>Head 1</th><th>Head 2</th></tr>
</thead>
<tbody>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</tbody>
</table>
Rob