首页 > 解决方案 > 如何使用引线垂直对齐 2 个块

问题描述

我需要使用 fo:leader 创建一个包含请求和响应的表,如下所示:

像这样的表领导

然而最终的结果是这样的:

两个块对齐顶部

我的问题是当左块有 2 行而右块有 2 行时,它们都在顶部对齐。我需要对齐顶部的左块和底部的右块。

那可能吗?

按照实际代码:

<fo:inline-container vertical-align="top" inline-progression-dimension="60%">
<fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify" margin-right="0.3cm"<xsl:value-of select="challenge/para|limitdesc/para|sopitem/para"/>
<fo:leader leader-pattern="dots"/</fo:block>
</fo:inline-container>
<fo:inline-container relative-position="relative" vertical-align="bottom" display-align="after" inline-progression-dimension="40%">
<fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after"><xsl:value-of select="response/para|limitvalue/para|limittext/para|act/para"/></fo:block>
</fo:inline-container>

标签: xsl-foantenna-house

解决方案


扩展@tmakita 的答案,您可以使用alignment-baseline来对齐两者的基线(参见https://www.w3.org/TR/xsl11/#fo_inline-containerfo:inline-container的讨论)。

您可以使用last-line-end-indent(参见https://www.w3.org/TR/xsl11/#last-line-end-indent)让领导项目超过文本末尾,但您还需要限制文本。在这个例子中,我在第一个fo:block-container里面使用了一个fo:inline-container

<fo:block>
    <fo:inline-container vertical-align="top" inline-progression-dimension="60%" alignment-baseline="text-after-edge">
        <fo:block-container width="50%">
            <fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify" last-line-end-indent="-100%">
            [3] Text here text here text here text here text here text here text here text here text here text here text here text here text here Text here text here text here text here text here text here text here<fo:leader leader-pattern="dots" leader-length.minimum="50%" leader-length.optimum="50%"/></fo:block>
        </fo:block-container>
    </fo:inline-container><fo:inline-container inline-progression-dimension="40%">
                <fo:block start-indent="0.5em" text-indent="-0.5em">
                    Continued text here text here text here text here
                </fo:block>
            </fo:inline-container>
</fo:block>

除非您希望最后一行上的文本能够超出其余部分,否则最小和最佳前导长度应该至少是两组文本之间间隙的宽度。


推荐阅读