我FOP通过混合xsl和xml文件来实现,从而获得一个PDF文件。
但我似乎无法正确地将表格向右移动。
我操纵了以下与以下attributes相关的FOP table:
start-indent:但是表格的内容移位超过了移位值的start-indent两倍,破坏了整体布局margin-left:这个属性在桌子上的效果似乎与start-indent
还有其他方法吗?
我FOP通过混合xsl和xml文件来实现,从而获得一个PDF文件。
但我似乎无法正确地将表格向右移动。
我操纵了以下与以下attributes相关的FOP table:
start-indent:但是表格的内容移位超过了移位值的start-indent两倍,破坏了整体布局 margin-left:这个属性在桌子上的效果似乎与start-indent 还有其他方法吗?
start-indent="20mm"如果您在fo:table元素和start-indent="0mm"on fo:table-body(以及 on fo:table-headerand fo:table-footer,如果使用它们)上指定,它应该可以工作。例如:
<fo:table table-layout="fixed" width="60mm"
border-style="solid" start-indent="20mm">
<fo:table-column column-width="40%"/>
<fo:table-column column-width="60%"/>
<fo:table-body start-indent="0mm" >
<fo:table-row>
<fo:table-cell border-style="solid">
<fo:block>Col1</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid">
<fo:block>Col2</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
start-indent是继承的财产。重置它使其不适用于fo:table.
我无法使其与margin-left(非继承属性)一起使用。这可能是一个 FOP 错误(它适用于XEP)。
另请参阅Xmlgraphics-fop wiki 上的解释 XSL-FO 中的缩进继承一文(尤其是“带有表格的更多示例”部分)。
如果上面的解决方案不起作用,还有另一种方法。它只是一个第一列空的表。所以它看起来像一个右移表。
<fo:block wrap-option="no-wrap">
<fo:table border-collapse="collapse" width="100%">
<fo:table-column column-width="proportional-column-width(60)" />
<fo:table-column column-width="proportional-column-width(20)" />
<fo:table-column column-width="proportional-column-width(20)" />
<fo:table-header />
<fo:table-body>
<fo:table-row>
<fo:table-cell />
<fo:table-cell>
<fo:block>John</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Doe</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell />
<fo:table-cell>
<fo:block>Peter</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Parker</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>