XSL:FO 用 fo:leader 填充 fo:block
XSL:FO Fill fo:block with fo:leader
我想用 <fo:leader leader-length.minium="1in"/ >
填充我的块,然后用可变文本(长度)填充其余部分。
问题是如果文本的内容需要更多 space 那么实际的列有一个换行符,一个点线和一个文本行。
我使用 Antenna House 和 XSLT 2.0。
现在的示例输出:
1: | ................Text Text |
2: |...........................|
|The Text is to long for the|
正确输出
|... This is some Text |
| of the text.... |
XSLT 代码:
<fo:table-cell>
<fo:block text-align="justify" text-align-last="right">
<xsl:if test="page">
<fo:leader leader-pattern="dots" leader-length.minimum="1in" leader-length.optimum="4in" leader-length.maximum="4in"/>
</xsl:if>
<fo:inline ><xsl:apply-templates select="page" mode="normal"/></fo:inline></fo:block>
</fo:table-cell>
我希望这能让正确的输出变得清晰。
|.... 10,15,2010| Five dots minimum
|______2105,1| (_ blank), output align right)
发生换行(AFAICT)是因为 AH Formatter 无法将最小前导加上文本放在一行中,然后当它被分成两行时,前导扩展到您的最佳长度 4 英寸。
求解:
将axf:text-align-first="justify"
添加到fo:block
。
text-align-last
(https://www.w3.org/TR/xsl11/#text-align-last) applies to the last line-area child of the (last) block-area, even when it's also the first line-area of the (only) block-area. axf:text-align-first
(https://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.text-align-first) 优先于 text-align-last
,因此 axf:text-align-first="justify"
证明 single-line 块。
删除leader-length.minimum
等
具有默认值 leader-length
的 fo:leader
现在将展开以填充可用的 space。
(可选)将 axf:leader-expansion="force"
添加到 fo:block
.
axf:leader-expansion
(https://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.leader-expansion) 在强制领导扩展方面做得更多。
示例:
<fo:block-container width="2in" border="thin solid black">
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is text</fo:block>
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is some of the text</fo:block>
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is some of the text plus a bit more</fo:block>
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is some of the text plus a whole lot more</fo:block>
</fo:block-container>
我想用 <fo:leader leader-length.minium="1in"/ >
填充我的块,然后用可变文本(长度)填充其余部分。
问题是如果文本的内容需要更多 space 那么实际的列有一个换行符,一个点线和一个文本行。
我使用 Antenna House 和 XSLT 2.0。
现在的示例输出:
1: | ................Text Text | 2: |...........................| |The Text is to long for the|
正确输出
|... This is some Text | | of the text.... |
XSLT 代码:
<fo:table-cell>
<fo:block text-align="justify" text-align-last="right">
<xsl:if test="page">
<fo:leader leader-pattern="dots" leader-length.minimum="1in" leader-length.optimum="4in" leader-length.maximum="4in"/>
</xsl:if>
<fo:inline ><xsl:apply-templates select="page" mode="normal"/></fo:inline></fo:block>
</fo:table-cell>
我希望这能让正确的输出变得清晰。
|.... 10,15,2010| Five dots minimum |______2105,1| (_ blank), output align right)
发生换行(AFAICT)是因为 AH Formatter 无法将最小前导加上文本放在一行中,然后当它被分成两行时,前导扩展到您的最佳长度 4 英寸。
求解:
将
axf:text-align-first="justify"
添加到fo:block
。text-align-last
(https://www.w3.org/TR/xsl11/#text-align-last) applies to the last line-area child of the (last) block-area, even when it's also the first line-area of the (only) block-area.axf:text-align-first
(https://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.text-align-first) 优先于text-align-last
,因此axf:text-align-first="justify"
证明 single-line 块。删除
leader-length.minimum
等具有默认值
leader-length
的fo:leader
现在将展开以填充可用的 space。(可选)将
axf:leader-expansion="force"
添加到fo:block
.axf:leader-expansion
(https://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.leader-expansion) 在强制领导扩展方面做得更多。
示例:
<fo:block-container width="2in" border="thin solid black">
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is text</fo:block>
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is some of the text</fo:block>
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is some of the text plus a bit more</fo:block>
<fo:block text-align="justify" text-align-last="right" axf:text-align-first="justify">
<fo:leader leader-pattern="dots"/>This is some of the text plus a whole lot more</fo:block>
</fo:block-container>