XSL-FO 并排放置 3 个表

XSL-FO Place 3 tables side bij side

我是 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 个相同的表格。有人可以帮忙吗?

将绝对定位 block-containers 中的每个 table 并排放置。像这样:

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

产量:

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