Apache FOP - 表格组件从第二页开始错位 [英] Apache FOP - Table component getting misaligned from second page onwards

查看:19
本文介绍了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天全站免登陆