gpt4 book ai didi

xslt - 将一组行保留在一个页面上,而不将其超出页面限制

转载 作者:行者123 更新时间:2023-12-02 05:26:26 24 4
gpt4 key购买 nike

我一直在对用于创建 PDF 的 XSL-FO(使用 Apache-FOP)样式表进行一些修复,其中涉及放入一些额外的行,这些行表示数据何时更改为不同的集合。

我已经将行插入到正确的位置并显示正常,但时不时地,这些“标题行”会出现在页面底部。因此,为了便于阅读,我在 table-row 元素上添加了 keep-with-next="always" ,并且效果很好,直到我注意到另一个问题。

当我在页面底部没有足够的空间时在一行中包含 keep-with-next="always" 时,下一行将显示在同一页面上,然后导致它遮盖该页面的页脚。然后下一行继续下一页。

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

我可以删除这一点,因为在页面底部有一个“标题行”并不是宇宙的尽头,但让它正常工作会很好,而且一如既往,学习很高兴为什么有些东西不能按你想要的方式工作

最佳答案

如果您不希望分页符出现在与下一行一起保留的行内,则需要在其子项上设置 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>

table-cell上没有keep-together

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

table-cell上使用keep-together

<!-- 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

关于xslt - 将一组行保留在一个页面上,而不将其超出页面限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21118023/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com