You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tableunits.fo 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  3. <!-- defines the layout master -->
  4. <fo:layout-master-set>
  5. <fo:simple-page-master master-name="first"
  6. page-height="29.7cm"
  7. page-width="21cm"
  8. margin-top="1cm"
  9. margin-bottom="2cm"
  10. margin-left="2.5cm"
  11. margin-right="2.5cm">
  12. <fo:region-body margin-top="3cm" margin-bottom="1.5cm"/>
  13. <fo:region-before extent="3cm"/>
  14. <fo:region-after extent="1.5cm"/>
  15. </fo:simple-page-master>
  16. </fo:layout-master-set>
  17. <!-- starts actual layout -->
  18. <fo:page-sequence master-reference="first">
  19. <fo:flow flow-name="xsl-region-body">
  20. <fo:block space-after="1cm" text-align="start" padding="0.4in" border="thick solid red">Table unit tests</fo:block>
  21. <fo:table border-collapse="separate" table-layout="fixed" width="6in">
  22. <fo:table-column column-width="(4.5in - 2cm) div 3 +1in" background-color="yellow"/>
  23. <fo:table-column column-width="(4.5in - 2cm) div 3 + 0.5in" background-color="blue"/>
  24. <fo:table-column column-width="(4.5in - 2cm) div 3 + 2.0cm" background-color="green"/>
  25. <fo:table-body>
  26. <fo:table-row>
  27. <fo:table-cell display-align="before"><fo:block>fixed width columns</fo:block></fo:table-cell>
  28. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  29. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  30. </fo:table-row>
  31. </fo:table-body>
  32. </fo:table>
  33. <fo:table border-collapse="separate" table-layout="fixed" width="6in">
  34. <fo:table-column column-width="1in + proportional-column-width(1)" background-color="yellow"/>
  35. <fo:table-column column-width="2 * (proportional-column-width(1) + .5in) div 2" background-color="blue"/>
  36. <fo:table-column column-width="proportional-column-width(1) + 2.0cm" background-color="green"/>
  37. <fo:table-body>
  38. <fo:table-row>
  39. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  40. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  41. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  42. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  43. </fo:table-row>
  44. <fo:table-row>
  45. <fo:table-cell background-color="blue"><fo:block>default alignment
  46. </fo:block></fo:table-cell>
  47. <fo:table-cell height="3cm" background-color="green" display-align="center"><fo:block>Centered with height=3cm</fo:block></fo:table-cell>
  48. <fo:table-cell background-color="yellow" display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  49. </fo:table-row>
  50. <fo:table-row height="3cm">
  51. <fo:table-cell><fo:block>default alignment but with a height
  52. of 3cm on the row </fo:block></fo:table-cell>
  53. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  54. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  55. </fo:table-row>
  56. </fo:table-body>
  57. </fo:table>
  58. <fo:block space-before="12pt" space-after="6pt">The next table has width=100% on the table no column widths specified on the table-column element.</fo:block>
  59. <!-- table start -->
  60. <fo:table border-collapse="separate" table-layout="fixed" width="100%">
  61. <fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
  62. <fo:table-column column-width="proportional-column-width(1)" background-color="blue"/>
  63. <fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
  64. <fo:table-body>
  65. <fo:table-row>
  66. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  67. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  68. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  69. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  70. </fo:table-row>
  71. </fo:table-body>
  72. </fo:table>
  73. <fo:block space-before="12pt" space-after="6pt">The next table has fixed column widths=13cm, ipd.optimum=12cm and ipd.max = 100%.</fo:block>
  74. <!-- table start -->
  75. <fo:table border-collapse="separate"
  76. table-layout="fixed" width="100%"
  77. inline-progression-dimension="12cm"
  78. inline-progression-dimension.maximum="100%"
  79. >
  80. <fo:table-column column-width="8cm" background-color="yellow"/>
  81. <fo:table-column column-width="proportional-column-width(2)" background-color="blue"/>
  82. <fo:table-column column-width="5cm" background-color="green"/>
  83. <fo:table-body>
  84. <fo:table-row>
  85. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  86. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  87. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  88. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  89. </fo:table-row>
  90. </fo:table-body>
  91. </fo:table>
  92. <fo:block space-before="12pt" space-after="6pt">The next table has fixed column widths=16.5cm, ipd.optimum=14cm and ipd.max = 100% (16cm).</fo:block>
  93. <!-- table start -->
  94. <fo:table border-collapse="separate" table-layout="fixed"
  95. inline-progression-dimension="14cm"
  96. inline-progression-dimension.maximum="100%">
  97. <fo:table-column column-width="8.5cm" background-color="yellow"/>
  98. <fo:table-column column-width="proportional-column-width(2)" background-color="blue"/>
  99. <fo:table-column column-width="8cm" background-color="green"/>
  100. <fo:table-body>
  101. <fo:table-row>
  102. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  103. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  104. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  105. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  106. </fo:table-row>
  107. </fo:table-body>
  108. </fo:table>
  109. <fo:block space-before="12pt" space-after="6pt">The next table has width="70% + 1cm" and fixed lengths and the first table-column has column-width="from-parent('width') div 3".</fo:block>
  110. <!-- table start -->
  111. <fo:table border-collapse="separate" table-layout="fixed" width="70% + 1cm">
  112. <fo:table-column column-width="from-parent('width') div 3" background-color="yellow"/>
  113. <fo:table-column column-width="proportional-column-width(1)" background-color="blue"/>
  114. <fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
  115. <fo:table-body>
  116. <fo:table-row>
  117. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  118. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  119. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  120. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  121. </fo:table-row>
  122. </fo:table-body>
  123. </fo:table>
  124. <fo:block space-before="12pt" space-after="6pt">
  125. The next table specifies inline-progression-dimension="15cm" instead of width. The
  126. middle column has a fixed width; the other two have default width.
  127. </fo:block>
  128. <!-- table start -->
  129. <fo:table border-collapse="separate"
  130. table-layout="fixed" width="100%"
  131. inline-progression-dimension="15cm">
  132. <fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
  133. <fo:table-column column-width="3cm" background-color="blue"/>
  134. <fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
  135. <fo:table-body>
  136. <fo:table-row>
  137. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  138. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  139. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  140. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  141. </fo:table-row>
  142. </fo:table-body>
  143. </fo:table>
  144. <fo:block space-before="12pt" space-after="6pt">
  145. The next table specifies neither width nor inline-progression-dimension.
  146. </fo:block>
  147. <!-- table start -->
  148. <fo:table table-layout="fixed" width="100%" border-collapse="separate">
  149. <fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
  150. <fo:table-column column-width="3cm" background-color="blue"/>
  151. <fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
  152. <fo:table-body>
  153. <fo:table-row>
  154. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  155. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  156. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  157. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  158. </fo:table-row>
  159. </fo:table-body>
  160. </fo:table>
  161. <fo:block space-before="12pt" space-after="6pt">
  162. The next table specifies inline-progression-dimension.minimum="10cm" and
  163. specifies a column width of 5cm on the middle column only.
  164. </fo:block>
  165. <!-- table start -->
  166. <fo:table table-layout="fixed" width="100%" border-collapse="separate"
  167. inline-progression-dimension.minimum="10cm">
  168. <fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
  169. <fo:table-column column-width="5cm" background-color="blue"/>
  170. <fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
  171. <fo:table-body>
  172. <fo:table-row>
  173. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  174. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  175. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  176. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  177. </fo:table-row>
  178. </fo:table-body>
  179. </fo:table>
  180. <fo:block space-before="12pt" space-after="6pt">
  181. The next table specifies inline-progression-dimension.minimum=&quot;10cm&quot;,
  182. inline-progression-dimension.maximum=&quot;17cm and
  183. specifies a column width of 5cm on the middle column only.
  184. </fo:block>
  185. <!-- table start -->
  186. <fo:table table-layout="fixed" width="100%" border-collapse="separate"
  187. inline-progression-dimension.minimum="10cm"
  188. inline-progression-dimension.maximum="17cm">
  189. <fo:table-column column-width="proportional-column-width(1)" background-color="yellow"/>
  190. <fo:table-column column-width="5cm" background-color="blue"/>
  191. <fo:table-column column-width="proportional-column-width(1)" background-color="green"/>
  192. <fo:table-body>
  193. <fo:table-row>
  194. <fo:table-cell display-align="before"><fo:block>Some text to make this cell
  195. deeper than the others to check out the alignment properties.</fo:block></fo:table-cell>
  196. <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
  197. <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
  198. </fo:table-row>
  199. </fo:table-body>
  200. </fo:table>
  201. </fo:flow>
  202. </fo:page-sequence>
  203. </fo:root>