Apache FOP-表组件从第二页开始未对齐 [英] Apache FOP - Table component getting misaligned from second page onwards

查看:81
本文介绍了Apache FOP-表组件从第二页开始未对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FOP 2.0版.我的模板的第一页上有一些文本段落,然后是一个动态表,该表的行数为n.

I am using FOP version 2.0. My template has some text paragraphs on first page after which there is a dynamic table with n number of rows.

问题是表格布局是完美的,直到生成的PDF文件首页上的行为止.但是,当它在第二页上继续时,各列将向右移动一定距离,而最后一列将变为不可见.任何对此的见解可能是什么原因?

The issue is that The table layout is perfect till the rows on first page of the generated PDF file. But when it continues on the 2nd page, the columns are shifted to the right by some margin and the last column becomes invisible. Any insight on this what may be the reason?

<fo:layout-master-set>
    <fo:simple-page-master master-name="first" margin-right="0.5cm"
                           margin-left="0.5cm" margin-bottom="0.5cm"
                           margin-top="0.75cm" page-width="21cm"
                           page-height="29.7cm">
      <fo:region-body></fo:region-body>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="rest" margin-right="2.5cm"
                           margin-left="2.5cm" margin-bottom="2cm"
                           margin-top="1cm" page-width="21cm"
                           page-height="29.7cm">
      <fo:region-body></fo:region-body>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="psmA">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="first"
                                              page-position="first"/>
        <fo:conditional-page-master-reference master-reference="rest"
                                              page-position="rest"/>
        <!-- recommended fallback procedure -->
        <fo:conditional-page-master-reference master-reference="rest"/>
      </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="psmA">
    <fo:flow flow-name="xsl-region-body">

 <fo:block-container height="0.5cm" width="7.40cm" top="8.80cm"
                          left="0.3cm" padding=".4mm" position="absolute">
        <fo:block text-align="start" space-after.optimum="3pt"
                  line-height="14pt" font-family="sans-serif" font-size="12pt">Header
                                                                               Options</fo:block>
      </fo:block-container>
      <fo:block-container border-style="solid" border-width=".5mm"
                          height="1.00cm" width="16.40cm" top="8.80cm"
                          left="3.40cm" padding=".4mm" position="absolute">
        <fo:block text-align="start" space-after.optimum="3pt"
                  line-height="14pt" font-family="sans-serif" font-size="12pt">$header.miscInfo</fo:block>
      </fo:block-container>

       <fo:block  margin-left="0.40cm" margin-top="10.30cm" padding=".4mm" >
        <fo:table border-top-style="solid" border-top-width="thick" >
        <fo:table-header text-align="center" >
        <fo:table-row border-bottom-style="solid" border-bottom-color="#000"
                          border-bottom-width="thick">
              <fo:table-cell padding-top="1mm" padding-bottom="1mm">

,并且表行以迭代的方式在标头之后继续.

对此有何见解?可能是这种行为的原因吗?

and the table rows continue in an iterative manner after the header.

Any insight on this what may be the reason for this behaviour?

谢谢.

推荐答案

您的文档有两种页面,具体由您的fo:simple-page-master元素定义:

Your document has two kind of pages, as defined by your fo:simple-page-master elements:

  • 第一页是使用名为first的页面母版创建的,该页面母版的边距很小(左右两侧均为0.5厘米)
  • 以下页面是用rest页面母版创建的,其页边距要宽得多(每页2.5厘米)
  • the first page is created using the page master named first which has small side margins (0.5 cm on both left and right sides)
  • the following pages are created with the rest page master, whose side margins are much wider (2.5 cm each)

您可能应该修改页面母版定义,以在所有页面类型上具有相似的左,右页边距.

You should probably modify the page master definitions to have similar left and right margins on all the page types.

这篇关于Apache FOP-表组件从第二页开始未对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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