XSL-FO 入门教程 XSL-FO table 对象

2024-02-26 开发教程 XSL-FO 入门教程 匿名 0

XSL-FO table 对象


定义和用法

<fo:table> 对象用于格式化表格的表格式材料。

<fo:table> 对象包含了可选的 <fo:table-column> 对象、一个可选的 <fo:table-header> 对象、一个 <fo:table-body> 对象,以及一个可选的 <fo:table-footer> 对象。上述对象中的每个对象都包含一个或多个 <fo:table-row> 对象(该对象中同样包含一个或多个 <fo:table-cell> 对象)。


语法

<fo:table>
<!--
Contents:(table-column*,table-header?,
table-footer?,table-body+)
-->
</fo:table>

属性

属性 [A-J]属性 [K-Z]
azimuthkeep-together
background-attachmentkeep-with-next
background-colorkeep-with-previous
background-imageleft
background-repeatmargin-bottom
background-position-horizontalmargin-left
background-position-verticalmargin-right
block-progression-dimensionmargin-top
border-after-colorpadding-after
border-after-precedencepadding-before
border-after-stylepadding-bottom
border-after-widthpadding-end
border-before-colorpadding-left
border-before-precedencepadding-right
border-before-stylepadding-start
border-before-widthpadding-top
border-bottom-colorpause-after
border-bottom-stylepause-before
border-bottom-widthpitch
border-collapsepitch-range
border-end-colorplay-during
border-end-precedencerelative-position
border-end-stylerichness
border-end-widthright
border-left-colorrole
border-left-stylesource-document
border-left-widthspace-after
border-right-colorspace-before
border-right-stylespeak
border-right-widthspeak-header
border-separationspeak-numeral
border-start-colorspeak-punctuation
border-start-precedencespeech-rate
border-start-stylestart-indent
border-start-widthstress
border-top-colortable-layout
border-top-styletable-omit-footer-at-break
border-top-widthtable-omit-header-at-break
bottomtop
break-aftervoice-family
break-beforevolume
cue-afterwidth
cue-beforewriting-mode
elevation
end-indent
height
id
inline-progression-dimension
intrusion-displace

实例 1

一个简单的表格:

<fo:table-and-caption>
<fo:table>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-header>
<fo:table-cell>
<fo:block font-weight="bold">Car</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-weight="bold">Price</fo:block>
</fo:table-cell>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>Volvo</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>$50000</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>SAAB</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>$48000</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-and-caption>

上面代码的输出如下所示:

CarPrice
Volvo$50000
SAAB$48000