2012-09-12 30 views
0

我通過混合xslxml文件來實現FOP,從而獲得PDF文件。將fop表移動到右邊

但我似乎無法正確地將表格向右移。
我操縱下面FOP attributes相關table

  1. start-indent:但表的內容通過兩次破壞整體佈局
  2. margin-left移位比start-indent的 移位值更:這屬性似乎在表格上以相同的方式起作用start-indent

還有其他方法嗎?

回答

2

如果指定,也就是說,在fo:table-bodystart-indent="20mm"fo:table元素和start-indent="0mm"它應該工作(並在fo:table-headerfo: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文章(特別是「關於表的其他示例」一節)。

0

如果上述解決方案不起作用,還有另一種方法。這只是一張空的第一列。所以它看起來像一個右移表。

<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> 
  • 該表具有100%的寬度和第一列是空的。
  • 列具有百分比寬度。
  • 明顯不允許使用列寬的%,請改用比例列寬。
  • 在此示例中沒有標題名稱,但可以添加除第一列以外的名稱。
  • 如果需要邊框,則應該在第一個邊框之外進行。