如何使用引线垂直对齐2个块

问题描述 投票:0回答:2

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

Table leader like this

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

Both block align top

我的问题是当左块有两条线而右块有两条线时它们都在顶部对齐。我需要将左侧块与顶部右侧块对齐。

那可能吗?

按照当前的代码:

<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-fo antenna-house
2个回答
0
投票

我尝试使用AH Formatter并找到了两个解决方案。

[1]使用baseline-shift作为后者的fo:inline-container

<fo:block>
    <fo:inline-container vertical-align="top" inline-progression-dimension="60%">
        <fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify">
            [1] Text here text here text here text here text here text here text here
            <fo:leader leader-pattern="dots"/></fo:block></fo:inline-container><fo:inline-container baseline-shift="-1.44em" inline-progression-dimension="40%">
        <fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after">
            Continued text here text here text here text here
        </fo:block>
    </fo:inline-container>
</fo:block>

我指定`baseline-shift =“ - 1.44em”。 (这取决于使用的字体)此方法仅在第一行计数等于2时有效。

[2]使用fo:table而不是fo:inline-container

<fo:table width="100%">
    <fo:table-column column-number="1" column-width="60%"/>
    <fo:table-column column-number="2" column-width="40%"/>
    <fo:table-body>
        <fo:table-row>
            <fo:table-cell>
                <fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify">
                    [2] Text here text here text here text here text here text here text here
                    <fo:leader leader-pattern="dots"/></fo:block>
            </fo:table-cell>
            <fo:table-cell/>
        </fo:table-row>
        <fo:table-row>
            <fo:table-cell/>
            <fo:table-cell padding-before="-1.32em">
                <fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after">
                    Continued text here text here text here text here
                </fo:block>
            </fo:table-cell>
        </fo:table-row>
    </fo:table-body>
</fo:table>

此方法不依赖于第一个fo:table-cell中的文本行。

使用AH Formatter GUI的两种格式化结果:

Formatting result in AH Formatter GUI

我的Formatter版本是6.4。但结果将是一样的。


0
投票

扩展@tmakita的答案,你可以使用alignment-baseline来对齐两个fo:inline-container的基线(参见https://www.w3.org/TR/xsl11/#fo_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>

除非您希望最后一行上的文本能够延伸到其余行,否则最小和最佳引导长度应至少为两组文本之间的间隙宽度。

© www.soinside.com 2019 - 2024. All rights reserved.