Как заставить заголовок таблицы XSL-FO повторяться на каждой странице, когда таблица охватывает несколько страниц?

У меня есть очень длинные таблицы, которые охватывают несколько страниц, отображаемых с помощью Apache-FOP 1.1

таблица имеет заголовок, например "таблица 7.6. Подробности чего-то" и заголовки столбцов.

на каждой продолжаемой странице заголовки столбцов правильно повторяются вверху. Но мне также нужно, чтобы Продолжение таблицы имело заголовок, а также в виде: "таблица 7.6. Подробности чего-то (продолжение)"

есть ли способ сделать это с помощью XSL-FO и Апач-ФОП? или это требует расширений, возможно, доступных через RenderX?

1 ответов


Я не знаю, как это сделать в 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

enter image description here

пример вывода PDF Страница 2

enter image description here