如何在fo-block中绘制水平线?

时间:2013-11-15 16:53:17

标签: xsl-fo

我需要实现下一个布局:

enter image description here

这是我的代码:

<fo:block text-align="center">United Nations Organisation</fo:block>                
<fo:block border-top-style="solid" text-align="center">(organisation)</fo:block>        
<fo:block border-top-style="solid" text-align="center">(department)</fo:block>

但实际上没有画出第二条水平线。 我怎么能实现这一目标?我做错了什么?

提前致谢!

2 个答案:

答案 0 :(得分:9)

您可以使用fo:leader

<fo:block text-align="center">United Nations Organisation </fo:block>   
<fo:leader leader-pattern="rule" leader-length="100%" rule-style="solid" rule-thickness="2pt"/>             
<fo:block text-align="center" font-size="8pt" margin-top="1mm">(organisation)</fo:block>        
<fo:leader leader-pattern="rule" leader-length="100%" rule-style="solid" rule-thickness="2pt"/>
<fo:block text-align="center" font-size="8pt" margin-top="1mm">(department)</fo:block>

答案 1 :(得分:2)

您需要使用border-bottom-width和border-bottom-style

我更改了margin-top以匹配您的示例。

<fo:block border-bottom-width="2pt" border-bottom-style="solid" border-bottom-color="black" font-weight="bold" text-align="center">United Nations Organisation </fo:block>                
<fo:block text-align="center" font-size="8pt" margin-top="1mm">(organisation)</fo:block>        
<fo:block border-bottom-width="2pt" border-bottom-style="solid" margin-top="7mm"></fo:block>
<fo:block text-align="center" font-size="8pt" margin-top="1mm">(department)</fo:block>

希望这会有所帮助。

相关问题