如何在最后一页上创建页脚

如何在最后一页上创建页脚

本文介绍了如何在最后一页上创建页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是干净的代码:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
        <fo:simple-page-master
                master-name="pages-normale"
                page-width="297mm"
                page-height="210mm"
                margin-top="0.5cm"
                margin-bottom="0.5cm"
                margin-left="0.5cm"
                margin-right="0.5cm">
            <fo:region-body   margin-top="1cm" margin-bottom="1cm"/>
            <fo:region-before margin-top="1cm" margin-bottom="1cm" extent="7cm"/>
            <fo:region-after  margin-top="1cm" margin-bottom="1cm" extent="1cm"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence
            master-reference="pages-normale"
            initial-page-number="1"
            force-page-count="even"
            language="it"
            country="it">
        <fo:static-content flow-name="xsl-region-before">
            <fo:block>
                <fo:table  width="100%" border-width="0.5mm" margin-bottom="4mm" border-style="transparent">
                    <fo:table-column  column-width="50%"/>
                    <fo:table-column  column-width="50%"/>
                    <fo:table-header>
                        <fo:table-row>
                            <fo:table-cell border-style="normal">
                                <fo:block font-size="15" font-style="oblique" font-weight="bold">

                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell border-style="normal">
                                <fo:block font-size="8" font-weight="normal" text-align="right"/>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-header>
                    <fo:table-body>
                        <fo:table-row>
                            <fo:table-cell border-style="transparent">
                                <fo:block>
                                    <fo:block font-size="8" text-align="left" font-weight="normal" >
                                    </fo:block>
                                </fo:block>
                            </fo:table-cell>
                            <fo:table-cell border-style="transparent">
                                <fo:block>
                                    <fo:block font-size="8" text-align="left" font-weight="normal" >
                                    </fo:block>
                                </fo:block>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>
            </fo:block>
        </fo:static-content>
        <fo:static-content flow-name="xsl-region-after">
            <fo:block>
                <xsl:value-of select="intestazione2_1/cliente3"/>
            </fo:block>
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
            <fo:block>

            </fo:block>
            <fo:block>

            </fo:block>
        </fo:flow>
    </fo:page-sequence>
</fo:root>

这是我尝试过的代码:

我是在版面母版上制作的:

I made this on layout master-set:

<fo:layout-master-set>
    <fo:simple-page-master
                master-name="pages-normale"
                page-width="297mm"
                page-height="210mm"
                margin-top="0.5cm"
                margin-bottom="0.5cm"
                margin-left="0.5cm"
                margin-right="0.5cm">
        <fo:region-body   margin-top="1cm" margin-bottom="1cm"/>
        <fo:region-before region-name="normal-header" margin-top="1cm" margin-bottom="1cm" extent="7cm"/>
        <fo:region-after  region-name="normal-footer" margin-top="1cm" margin-bottom="1cm" extent="1cm"/>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="pages">
        <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="pages-last" page-position="last"/>
            <fo:conditional-page-master-reference master-reference="pages-normale" />
        </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
</fo:layout-master-set>

然后在以下代码上进行此操作:

And go this on the following code:

 <fo:page-sequence
        master-reference="pages-normale"

按照页面顺序执行此操作:

Do this in the page sequence:

<fo:page-sequence force-page-count="no-force"
                    master-reference="pages" initial-page-number="auto"
                    format="1">
    <fo:static-content flow-name="normal-footer">
        <xsl:value-of select="intestazione2_1/cliente3"/>
    </fo:static-content>
</fo:page-sequence>

我试图将此页面序列放入< fo:page-sequence中master-reference ="pages-normale" 但是错误是相同的.

I've tried to put this page sequence in and out of the <fo:page-sequence master-reference="pages-normale"But the error is the same.

这是FOP给我的错误:

Here the error that FOP gives me:

这是我遵循的建议:

推荐答案

除了您的< fo:simple-page-master master-name ="pages-normale"> 定义< fo:simple-page-master master-name ="pages-last"> .

在此母版中,您需要为末页< fo:region-after region-name ="last-page-footer" 定义一个具有唯一名称的页脚.然后,在页面顺序中,可以添加< fo:static-content flow-name ="last-page-footer"> 并添加要在该页脚中显示的信息.

In this master, you need to define a footer with a unique name for the last page <fo:region-after region-name="last-page-footer". Then in your page-sequence, you can add <fo:static-content flow-name="last-page-footer"> and add the information you want to display in that footer.

这篇关于如何在最后一页上创建页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 21:39