gpt4 book ai didi

xsl-fo - 当表格跨越多页时,如何让 XSL-FO 表格标题在每一页上重复?

转载 作者:行者123 更新时间:2023-12-04 15:01:13 27 4
gpt4 key购买 nike

我有一些很长的表格,它们跨越多个页面,用 Apache-FOP 1.1 呈现

表格有标题,例如“表 7.6. 事物的详细信息”和列标题。

在每个连续页面上,列标题在顶部正确重复。但我还需要让表格延续也有标题,格式为:“表 7.6. 细节(续)”

有没有办法用 XSL-FO 和 Apache-FOP 做到这一点?或者它是否需要通过 RenderX 提供的扩展?

最佳答案

我不知道有什么方法可以在 FOP 中做到这一点,但这可能是因为除了基本的 PDF 生成之外,我还没有将 FOP 用于任何其他方面。

使用 RenderX (XEP),您可以设置您的 fo:table-header到您想在后续页面上使用的任何标题,并使用常规 fo:block对于初始标题。

然后您可以使用 rx:table-omit-initial-header="true"您的 fo:table 上的属性首次输出表时不输出表头。

这是 RenderX 4.18 渲染的示例...

示例 XSL-FO

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:rx="http://www.renderx.com/XSL/Extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page" page-width="8.5in" page-height="11in">
<fo:region-body margin="1in" margin-top="1.5in" margin-bottom="1.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="12pt" font-weight="bold"
text-align="center" space-after="6pt">Sample Table</fo:block>
<fo:block>
<fo:table rx:table-omit-initial-header="true" space-before=".08in">
<fo:table-column column-width="100%"/>
<fo:table-header>
<fo:table-cell>
<fo:block font-weight="bold"
font-size="12pt" text-align="center"
space-after="6pt">Sample Table (Cont)</fo:block>
</fo:table-cell>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:table border-style="solid" border-width="1pt" padding="6pt">
<fo:table-column column-number="1" column-width="20%"/>
<fo:table-column column-number="2" column-width="80%"/>
<fo:table-header font-weight="bold">
<fo:table-cell text-align="left">
<fo:block>Column 1</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Column 2</fo:block>
</fo:table-cell>
</fo:table-header>
<fo:table-body>
<fo:table-row padding-before="20px">
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>Lorem ipsum dolor sit amet</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn’t commit. These men promptly escaped from a
maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune.</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>

示例 PDF 输出页面 1

enter image description here

PDF 输出示例第 2 页

enter image description here

关于xsl-fo - 当表格跨越多页时,如何让 XSL-FO 表格标题在每一页上重复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13922082/

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