2011-07-29 125 views
16

我想將文本對齊到第二個單元格的底部。 第一個單元格擴展爲2行,因爲寬度不足並且沒有問題 但是第二個單元格中的文本只有一行,並顯示在單元格的頂部。 如何將它對齊到底?表格單元格中文本的垂直對齊

我試過 排垂直對齊= 「自下而上」 的text-align = 「底」 的text-align = 「結束」,細胞和阻斷水平。任何人的工作?!?

<fo:table font="normal 10 pt Arial, sans-serif" width="100%"> 
<fo:table-column column-width="40mm"/> 
<fo:table-column column-width="130mm"/> 
<fo:table-body> 
<fo:table-row> 
    <fo:table-cell padding-before="3pt" padding-after="3pt"> 
    <fo:block font-weight="bold">Pricing Rate in % p.a./"Pensionssatz in % p.a.":</fo:block> 
    </fo:table-cell> 
    <fo:table-cell padding-before="3pt" padding-after="3pt"> 
    <fo:block> 
    **This text I want to be aligned to bottom (in the second line)** 
    </fo:block> 
    </fo:table-cell> 
</fo:table-row> 
</fo:table-body> 
</fo:table> 

回答

32

在表格單元格使用display-align="after"

<fo:table-cell padding-before="3pt" padding-after="3pt" display-align="after"> 
<fo:block> 
    **This text I want to be aligned to bottom (in the second line)** 
</fo:block> 
</fo:table-cell> 
+0

謝謝!這很好.. – AbsoleteMe

+1

就像一個提示,希望在中間垂直排列文本的人 - 它不適用於Apache FOP:http://xmlgraphics.apache.org/fop/compliance.html# fo-property-vertical-align – rbaleksandar

+0

在我的情況下,display-align屬性根本不起作用。 – masche

0

萬一有人發現了這個問題:

如果你有一個形象,你上面的文字不想保持一致,但後之前:

<fo:table-cell display-align="before"> 
<!-- Your image & text separated in blocks --> 
<fo:table-cell> 
相關問題