6

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

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

在每个续页上,列标题在顶部正确重复。但我还需要让表格延续也有标题,形式为:“表 7.6。某事的详细信息(续)”

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

4

1 回答 1

6

我不知道在 FOP 中执行此操作的方法,但这可能是因为我没有将 FOP 用于生成基本 PDF 之外的任何内容。

使用 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

在此处输入图像描述

示例 PDF 输出页面 2

在此处输入图像描述

于 2012-12-18T07:33:17.700 回答