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 11KB

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