2016-06-10 32 views
0

我試圖建立一個樹的一個零件,列表,像:XSLT - XSL:FO PDF表格的行高 - Unicode的塊元素在樹

The Tree

但是當我嘗試以符合垂直線(Courier New,HTML十進制:&#9474),它不會完全符合下一個塊元素。我仔細檢查了所有邊界,邊距和填充。

我還認爲,也許黑色元素本身不會填充標誌,空間,但事實並非如此,正如您可以在圖片上看到的那樣。條帶右側的元素與垂直線的大小相同。而隨着行權的元素完全吻合,垂直行不:

enter image description here

這裏是嵌套在一起的表的代碼:

<fo:table-body> 
[...] 
<fo:table-row font-size="8pt" padding-top="0pt" 
    margin-bottom="-3pt" margin-top="0pt" vertical-align="center" 
    font-family="MyCourierNew"> 
    <fo:table-cell border-left="{$Standardrand}" font-size="11pt" font-family="MyCourierNew"> 
     <fo:block> 
      <xsl:if test="$ben2 != ''"> 
       <xsl:choose> 
        <xsl:when test="$naechste &gt; $aktuelle"> 
         │ 
        </xsl:when> 
        <xsl:when test="$naechste = $aktuelle and $aktuelle &gt; 1"> 
         │ 
        </xsl:when> 
       </xsl:choose> 
      </xsl:if> 
     </fo:block> 
    </fo:table-cell> 
</fo:table-row> 

我認真找不到問題。

+0

不知道是否真的會解決這一點,但也許你可以嘗試設置明確所有邊界的頂部和底部邊框上'table-row'和'table-cell'爲0pt。 – potame

+1

我懷疑你的Courier New(或者'MyCourierNew')字體是否具有箱形圖符(除非你將它們添加到'MyCourierNew'中)。有關Monotype的Courier New中的字形,請參見http://www.myfonts.com/fonts/mti/courier-new/courier-new/glyphs.html。因此,您的格式化程序可能無論如何都會替換不同字體的字形。此外,如果您可以添加實際的XSL-FO標記的片段,這將有所幫助。最後,將「padding-top」和「padding-bottom」設置爲「0pt」,將「line-height」設置爲「1」可能會有所幫助。 –

+0

@TonyGraham將行高設置爲1解決了我的問題!非常感謝你! – MrOnkelChiller

回答

0

我不確定您生成的XSL-FO是什麼。但line-height.conditionality =「丟棄」可能會對你有所幫助。此屬性設置刪除行前後的半前導。所以它適用於這種情況。

這是我的格式化結果,使用&#9474 ;.

Sample formatting result

這裏是我的XSL-FO

<fo:table-and-caption> 
    <fo:table border-after-width.conditionality="retain" 
     border-before-width.conditionality="retain" border-bottom="2pt solid black" 
     border-left="2pt solid black" border-right="2pt solid black" 
     border-top="2pt solid black" font-size="9.5pt" space-after="2mm"> 
     <fo:table-column 
      column-width="20mm" text-align="left"/> 
     <fo:table-column 
      column-width="40mm" text-align="left"/> 
     <fo:table-column 
      column-width="20mm" text-align="left"/> 
     <fo:table-column 
      column-width="20mm" text-align="left"/> 
     <fo:table-body start-indent="3pt"> 
      <fo:table-row font-size="8pt" display-align="center" font-family="Arial"> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>35</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black" font-family="Courier New" font-size="11pt" line-height.conditionality="discard"> 
        <fo:block>1</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>2</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>8247947</fo:block> 
       </fo:table-cell> 
      </fo:table-row> 
      <fo:table-row font-size="8pt" display-align="center" font-family="Arial"> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>35</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black" font-family="Courier New" font-size="11pt" line-height.conditionality="discard"> 
        <fo:block>&#x2502;</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>2</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>8247947</fo:block> 
       </fo:table-cell> 
      </fo:table-row> 
      <fo:table-row font-size="8pt" display-align="center" font-family="Arial"> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>35</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black" font-family="Courier New" font-size="11pt" line-height.conditionality="discard"> 
        <fo:block>&#x251C;2</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>2</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>8247947</fo:block> 
       </fo:table-cell> 
      </fo:table-row> 
      <fo:table-row font-size="8pt" display-align="center" font-family="Arial"> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>35</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black" font-family="Courier New" font-size="11pt" line-height.conditionality="discard"> 
        <fo:block>&#x2502;</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>2</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>8247947</fo:block> 
       </fo:table-cell> 
      </fo:table-row> 
      <fo:table-row font-size="8pt" display-align="center" font-family="Arial"> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>35</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black" font-family="Courier New" font-size="11pt" line-height.conditionality="discard"> 
        <fo:block>&#x2514;3</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>2</fo:block> 
       </fo:table-cell> 
       <fo:table-cell border-end-width="1pt" border-end-style="solid" border-end-color="black"> 
        <fo:block>8247947</fo:block> 
       </fo:table-cell> 
      </fo:table-row> 
     </fo:table-body> 
    </fo:table> 
</fo:table-and-caption> 
+0

'line-height.conditionality =「discard」'適用於垂直線,但搞砸了我的文檔的其餘部分......但是我修正了它。 :)謝謝你的努力! – MrOnkelChiller