在一个页面上保留一组行而不将其推到页面限制之上

top*_*erg 3 xslt apache-fop

我已经对XSL-FO(使用Apache-FOP)样式表应用了一些修复来创建PDF,其中涉及添加一些额外的行,表示数据何时更改为不同的集合.

我已经将行插入到正确的位置并显示确定,但是不时地,这些"标题行"将出现在页面的底部.因此,为了便于阅读,我将其包含keep-with-next="always"table-row元素中,并且在我注意到另一个问题之前一切正常.

当我keep-with-next="always"在页面底部没有足够空间的情况下包含行时,下一行显示在同一页面上,然后使其模糊该页面的页脚.然后下一行继续下一页.

所以,我要问的是,有没有办法收集行,当它们的组合高度大于剩余空间时,它会将整个行移动到新页面上?我考虑过使用嵌套表,但我被别人建议避免这样做(出于某种未知的原因,但如果这是唯一的解决方案,请点击它们,我正在这样做)

我可以删除这个位,因为它不是宇宙的末端,在页面的底部有一个"标题行",但是让它正常工作会很好,并且一如既往,很高兴了解为什么有些东西没有按照你想要的方式工作

Rus*_*kin 5

如果您不希望分页显示在与下一行保持的行内,则需要keep-together.within-page在其子项上设置该属性:

<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>
Run Code Online (Sandbox Code Playgroud)

没有keep-togethertable-cell

row 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
Run Code Online (Sandbox Code Playgroud)

随着keep-togethertable-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
Run Code Online (Sandbox Code Playgroud)