xsl-fo在表格和图像之间添加间距

时间:2014-10-23 12:27:11

标签: xsl-fo spacing

我在一张景观页面上放了一张桌子。我想将图像放在桌子的左边,并在图像和桌子之间添加一些间距。

这是我的代码:

<fo:layout-master-set>
<fo:simple-page-master   
master-name="A4"
page-width="29.7cm"
page-height="21.0cm"
margin-top="0.5cm"
margin-bottom="1.0cm"
margin-left="4.0cm"
margin-right="1.0cm"
> 
<fo:region-body margin="1.0cm" writing-mode="rl"/>
<fo:region-before extent="5.0cm" />
<fo:region-after extent="1.0cm"/>
<fo:region-start margin="3.0cm" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4">

<fo:static-content flow-name="xsl-region-start">

<fo:block-container reference-orientation="90" > 

<fo:block text-align="center">

<fo:external-graphic src="path to image" content-height="scale-to-fit" height="1cm" width="7cm"  scaling="non-uniform" />
</fo:block>



</fo:block-container>

</fo:static-content>

<fo:flow flow-name="xsl-region-body">

<fo:table table-layout="fixed" width="50%" height="100%" left="5cm">

<fo:table-column column-width="13cm" />

<fo:table-column column-width="8cm" />

<fo:table-body>

<fo:table-row>
    <fo:table-cell>
        <fo:block>

        Lorem ipsum text 

        </fo:block>

    </fo:table-cell>

</fo:table-row>


</fo:table-body>

</fo:table>
</fo:flow>
</fo:page-sequence>

正如您所看到的,我已尝试将图像插入到页面的区域开始区域,但我似乎无法在图像和表格之间添加间距。我将如何做到这一点,或者我可以采取不同的方式来实现相同的结果?

1 个答案:

答案 0 :(得分:0)

因为您的块容器已旋转:

<fo:block-container reference-orientation="90" > 

图像的垂直尺寸为7厘米:&#34;高度&#34;和&#34;宽度&#34;容器内的块也旋转。所以你的头高7厘米。

您还没有在标题底部指定任何空格。您可以将标题包装在具有底部边距的块容器中:

<fo:block-container margin-bottom="1 cm">