2013-05-17 38 views
1


好日子 我有這個XSL-FO
XSL-FO適用半徑頂部邊框

<fo:table table-layout="fixed" border-width="0.2mm" border-color="#330099" border-style="groove" 
      border-collapse="separate" background-color="white" line-height="16pt" space-before.optimum="10pt" 
      space-after.optimum="6pt" text-align="left" >  
       <fo:table-column column-width="37mm"/> 
       <fo:table-column column-width="37mm"/> 
       <fo:table-column column-width="37mm"/> 
       <fo:table-column column-width="37mm"/> 
       <fo:table-column column-width="37mm"/> 
       <!-- <fo:table-column column-width="38mm"/> --> 
     <fo:table-body> 
      <fo:table-row> 
       <fo:table-cell border-width="0.01mm" border-color="#330099" border-style="groove" background-color="lightgrey"> 
        <fo:block text-align="left" color="#000000" font-size="8pt" font-weight="bold">Account Number</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-width="0.01mm" border-color="#330099" border-style="groove" background-color="lightgrey"> 
        <fo:block text-align="left" color="#000000" font-size="8pt" font-weight="bold">Customer Id</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-width="0.01mm" border-color="#330099" border-style="groove" background-color="lightgrey"> 
        <fo:block text-align="left" color="#000000" font-size="8pt" font-weight="bold">Account Currency</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-width="0.01mm" border-color="#330099" border-style="groove" background-color="lightgrey"> 
        <fo:block text-align="right" color="#000000" font-size="8pt" font-weight="bold">Opening Balance</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-width="0.01mm" border-color="#330099" border-style="groove" background-color="lightgrey"> 
        <fo:block text-align="right" color="#000000" font-size="8pt" font-weight="bold">Closing Balance</fo:block> 
       </fo:table-cell> 
      </fo:table-row> 

</fo:table-body> 
</fo:table> 


我的問題是:我想申請圓棒邊框這個表
是可能的邊界半徑?
或任何其他方法?

+1

你使用FOP嗎?請參閱http://xmlgraphics.apache.org/fop/trunk/extensions.html#rounded-corners和http://wiki.apache.org/xmlgraphics-fop/RoundedBorders(未經我測試)。 – mzjn

回答

1

選項1)最佳:爲每個角落創建小型SVG圖像,然後使用表格內的表格進行格式化...外部表格具有小的左/右列和上/下行,中間有一個大單元格。把你的桌子放在中心的大房間裏。你甚至可以用四個圓角圖像和適當的邊界應用來實現這一點。如果您需要使用此結構來遍歷一個突破頁面的表格,則角落圖片需要位於XSL FO的頁眉/頁腳中。選項2)差不多一樣好。如果您知道表格的寬度,只需在表格的頂部和底部放置圓形邊緣和線條,然後將表格與適當的左/右邊框進行匹配即可四處走動。您只能在表的開始/停止處添加單個行和單元格(跨所有列)。

選項3)取決於您的情況......如果表格的高度和寬度相當一致,則可以將圓角SVG圖像作爲背景圖像用於表格或封閉表格的塊。您可以縮放它以適應寬度和高度。這種方法可能會扭曲拐角的曲線,這就是爲什麼只有當你事先知道表格的尺寸時(或者至少可以近似它),我纔在這個方法中使用了這種方法,數學上已知的...也就是說,該表可以有5行或10行或其他任何東西,但寬度總是一致的...... XSL用於對行進行「計數」併爲背景選擇適當的外部SVG(如表-bg-row-5.svg ... table-bg-row-10.svg)

請注意,任何或所有這些在XSL FO中都沒有擴展名是可行的,並且允許您創建任何類型的自定義邊界表不只是圓角。

1

嘗試空間之前= 5毫米空間後= 5毫米

您可以在fo塊標籤中使用space-after = 5mm。示例

<fo:block space-after=5mm>Something</fo-block> 
<fo:block>SomethingSomething</fo:block> 

第一行將在文本「Something」後面創建5 mm的空間。

1

嘗試<fo:block space-after=5mm space-before=5mm>to get space both front and end/fo-block>