将 XSL-FO 块放在下一页而不是跨页拆分 [英] Put XSL-FO block on next page instead of splitting it across pages

查看:16
本文介绍了将 XSL-FO 块放在下一页而不是跨页拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 XSL-FO 模板,它打印了一些包含动态变化的文本的块.有时一个块被分成两页,因为页面上没有足够的空间.有没有办法将块放在下一页而不是在不适合的情况下将其拆分到页面上?我试图将它放入一个带有 keep-together="always" 的表格中,但是每个文本都在单行上(没有换行)并且溢出右边的页边距,它消失了.提前致谢!

I created an XSL-FO template which prints a few blocks containing texts that change dynamically. Sometimes a block is split across two pages because there is not enough space on the page. Is there a way to put the block on the next page instead of splitting it across pages if it does not fit? I tried to put it into a table with keep-together="always" but then each text is on single line (no line wrapping) and overflows the right page margin where it disappears. Thank you in advance!

  <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="proportional-column-width(1)"/>
    <fo:table-body>
      <fo:table-row keep-together="always">
        <fo:table-cell
          border-width="1px"
          border-color="black"
          border-style="solid"
          background-color="#ffffff"
          text-align="left">
          <fo:block>
            Text 1
          </fo:block>
          <fo:block>
            Text 2
          </fo:block>
          <fo:block>
            Text 3
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>        
  </fo:table>   

推荐答案

很可能,您可以使用 page-break-inside 属性:

Most likely, you could use the page-break-inside attribute:

<fo:block page-break-inside="avoid">
  ...
</fo:block>

还存在其他 page-break 属性.选择最好的:

There also exist other page-break attributes. Take the best one:

这篇关于将 XSL-FO 块放在下一页而不是跨页拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆