我通過混合xsl
和xml
文件來實現FOP
,從而獲得PDF
文件。將fop表移動到右邊
但我似乎無法正確地將表格向右移。
我操縱下面FOP attributes
相關table
:
start-indent
:但表的內容通過兩次破壞整體佈局margin-left
移位比start-indent
的 移位值更:這屬性似乎在表格上以相同的方式起作用start-indent
還有其他方法嗎?
我通過混合xsl
和xml
文件來實現FOP
,從而獲得PDF
文件。將fop表移動到右邊
但我似乎無法正確地將表格向右移。
我操縱下面FOP attributes
相關table
:
start-indent
:但表的內容通過兩次破壞整體佈局margin-left
移位比start-indent
的 移位值更:這屬性似乎在表格上以相同的方式起作用start-indent
還有其他方法嗎?
如果指定,也就是說,在fo:table-body
start-indent="20mm"
的fo:table
元素和start-indent="0mm"
它應該工作(並在fo:table-header
和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 上的Interpreting Indent Inheritance in 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>