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

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

XSL-FO table-and-caption 对象


定义和用法

下面列举了 9 个可以用来创建表格的 XSL-FO 对象:

  • fo:table-and-caption
  • fo:table
  • fo:table-caption
  • fo:table-column
  • fo:table-header
  • fo:table-footer
  • fo:table-body
  • fo:table-row
  • fo:table-cell

<fo:table-and-caption> 对象是一个包含所有表格对象的容器,它用于格式化表格及其标题。

<fo:table-and-caption> 对象包含了一个 <fo:table> 对象和一个可选的 <fo:caption> 对象。


语法

<fo:table-and-caption>
<!--
Contents:(table-caption?,table)
-->
</fo:table-and-caption>

属性

属性 [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
border-after-colormargin-top
border-after-stylepadding-after
border-after-widthpadding-before
border-before-colorpadding-bottom
border-before-stylepadding-end
border-before-widthpadding-left
border-bottom-colorpadding-right
border-bottom-stylepadding-start
border-bottom-widthpadding-top
border-end-colorpause-after
border-end-stylepause-before
border-end-widthpitch
border-left-colorpitch-range
border-left-styleplay-during
border-left-widthrelative-position
border-right-colorrichness
border-right-styleright
border-right-widthrole
border-start-colorsource-document
border-start-stylespace-after
border-start-widthspace-before
border-top-colorspeak
border-top-stylespeak-header
border-top-widthspeak-numeral
bottomspeak-punctuation
break-afterspeech-rate
break-beforestart-indent
caption-sidestress
cue-aftertext-align
cue-beforetop
elevationvoice-family
end-indentvolume
id
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