【问题标题】:xsl-fo add spacing between table and imagexsl-fo 在表格和图像之间添加间距
【发布时间】:2014-10-23 23:21:35
【问题描述】:

我在横向页面上放置了一张表格。我想在表格左侧放置一张图片,并在图片和表格之间添加一些间距。

这是我的代码:

<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>

如您所见,我尝试将图像插入到页面的区域开始区域,但我似乎无法在图像和表格之间添加间距。我将如何做这件事,或者我可以做不同的事情来获得相同的结果?

【问题讨论】:

    标签: xsl-fo spacing


    【解决方案1】:

    因为你的块容器是旋转的:

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

    图像以 7 厘米的垂直尺寸呈现:容器内的块的“高度”和“宽度”也被旋转。所以你的标题是7厘米高。

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

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

    【讨论】: