3

使用 apache FOP,想要创建一个带有左对齐徽标的标题,右对齐三行地址,都对齐顶部。

如果在流程内部完成以下工作正常,但在静态内容标题('xsl-region-before')中,它会左右正确,但会在地址块下方对齐徽标,就好像表定义被完全忽略了.

我尝试了其他选项,例如尝试将两者内联,或使用浮点数,结果相似。标题只是将它们视为单独的块并将它们堆叠起来。有人有什么建议吗?

我发现this other issue询问关于页脚的相同问题,唉,没有回复: 需要instream-foreign-object and text to both align to the bottom in XSL-FO

相关片段如下:

    <fo:layout-master-set>
        <fo:simple-page-master page-height="8.5in" page-width="11in" master-name="only" margin=".5in .5in .5in .5in">
            <fo:region-body region-name="xsl-region-body" margin-top="1in" margin-bottom=".5in"/>
            <fo:region-before region-name="xsl-region-before"/>
            <fo:region-after region-name="xsl-region-after"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="only">
        <fo:static-content flow-name="xsl-region-before">
                <fo:block font-size="7pt">
                    <fo:table width="10in">
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell>
                                    <fo:block>
                                        <fo:external-graphic src="img/print_logo.png" content-width="2in"/>
                                    </fo:block>
                                </fo:table-cell>
                                <fo:table-cell display-align="center">
                                    <fo:block text-align="right">
                                        123 Credibility Street
                                    </fo:block>
                                    <fo:block text-align="right">
                                        Chicago, IL  60606
                                    </fo:block>
                                    <fo:block text-align="right">
                                        312-123-4567
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-body>
                    </fo:table>
                </fo:block>
        </fo:static-content>
4

2 回答 2

4

我通过将这两个元素放在两个具有绝对定位的独立块容器中来达到预期的效果:

<fo:static-content flow-name="xsl-region-before">
    <fo:block-container position="absolute">
        <fo:block>
            <fo:external-graphic src="img/print_logo.png" content-width="2in"/>
        </fo:block>
    </fo:block-container>
    <fo:block-container position="absolute">
        <fo:block text-align="right">
            123 Credibility Street
        </fo:block>
        <fo:block text-align="right">
            Chicago, IL  60606
        </fo:block>
        <fo:block text-align="right">
            312-123-4567
        </fo:block>
    </fo:block-container>
</fo:static-content>
于 2010-06-15T16:36:29.917 回答
1

回复晚了,但必须回答问题。所以这里是:

是的,这里需要绝对定位,但更重要的是你放置的块容器的顺序。

最后一个容器的内容将在其他容器之上。

于 2012-05-02T10:47:20.413 回答