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

问题描述

这里是干净的代码:

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

然后执行以下代码:

 <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-sequencemaster-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:

在 page-sequence-master "fo:repeatable-page-master-alternatives" 中没有简单的 page-master 匹配 "pages-last".(没有可用的上下文信息)

这是我遵循的建议:

推荐答案

除了你的 你还需要定义 .

In addition to your <fo:simple-page-master master-name="pages-normale"> you need to define <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.

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

08-23 09:42