I have been applying some fixes to an XSL-FO (using Apache-FOP) stylesheet for creating PDFs, which has involved putting in some extra rows that signify when the data changes to a different set.
I have got the rows inserting at the correct position and displaying ok, but every now and again, these "header rows" would appear at the bottom of the page. So, for readability, I included keep-with-next="always" on the table-row element, and that worked fine until I noticed another issue.
When I include keep-with-next="always" on a row when there is not enough space at the bottom of the page, the next row is displayed on the same page, which then causes it to obscure the footer of that page. Then the next row continues on the next page.
So, what I am asking is, is there a way to have a collection of rows, that when their combined height is larger than the remaining space, that it will move the whole lot onto a new page? I have considered using nested tables, but I have been advised by someone else to avoid doing this (for some unknown reason, but if that's the only solution, sod them, i'm doing it)
I can remove this bit as its not the end of the universe to have a "header-row" at the bottom of the page, but it would be nice to have it working correctly, and as always, its nice to learn why something doesn't work the way you want it to
If you don't want the page break to appear inside the row that is being kept with the next row, you need to set the keep-together.within-page property on its children:
<fo:table-row keep-with-next.within-page="always">
    <fo:table-cell keep-together.within-page="always">
        row with keep-with-next text
        ...
    </fo:table-cell>
</fo:table-row>
<fo:table-row>
    <fo:table-cell>
        next row
    </fo:table-cell>
</fo:table-row>
keep-together on table-cellrow with keep-with-next text
row with keep-with-next text
<!-- page break -->
row with keep-with-next text
row with keep-with-next text
next row
keep-together on table-cell<!-- page break -->
row with keep-with-next text
row with keep-with-next text
row with keep-with-next text
row with keep-with-next text
next row
                        I had the same problem and This is how I solved it.
<fo:table-row keep-with-next.within-page="always">
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With