XSL-FO放置3个表侧bij侧

时间:2017-02-16 16:53:15

标签: xml xslt xsl-fo

我是XSL-FO(fop apache)我想并排放置3张桌子! 试了很多东西,但还没有找到解决方案。 这是我的代码的重要和平:

<fo:table  table-layout="fixed" width="60mm" keep-together.within-page="always"  border-width="1pt" border-style="solid" border-color="black" >

                        <fo:table-column column-width="40mm"/>
                        <fo:table-column column-width="20mm"/>

                        <fo:table-body>

                        <fo:table-row>
                            <fo:table-cell text-indent="1mm">
                                <fo:block>test:</fo:block>
                            </fo:table-cell>
                            <fo:table-cell>
                                <fo:block>test</fo:block>
                        </fo:table-cell>
                    </fo:table-row>

                        </fo:table-body>

                    </fo:table>

现在我想并排添加3个相同的表格。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

将每个表放在绝对定位的块容器中,彼此相邻。像这样:

            <fo:block-container absolute-position="absolute" top="1in" left="0in" width="2.4in">
            <fo:table>
                <fo:table-body>
                    <fo:table-row>
                        <fo:table-cell border="1pt solid black">
                            <fo:block>I am Table 1</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="1pt solid black">
                            <fo:block>I am Table 1</fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
        </fo:block-container>
        <fo:block-container absolute-position="absolute" top="1in" left="2.5in" width="2.4in">
            <fo:table>
                <fo:table-body>
                    <fo:table-row>
                        <fo:table-cell border="1pt solid black">
                            <fo:block>I am Table 2</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="1pt solid black">
                            <fo:block>I am Table 2</fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
        </fo:block-container>
        <fo:block-container absolute-position="absolute" top="1in" left="5in" width="2.4in">
            <fo:table>
                <fo:table-body>
                    <fo:table-row>
                        <fo:table-cell border="1pt solid black">
                            <fo:block>I am Table 3</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="1pt solid black">
                            <fo:block>I am Table 3</fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
        </fo:block-container>

收率:

enter image description here

还有其他方法,但我不认为FOP支持它们。如果您使用的是RenderX,则可以使用3列的rx:flow-section,并在每个列中放置一个表。