aboutsummaryrefslogtreecommitdiffstats
path: root/docs/examples/fo/tableunits.fo
blob: 502e676fc7faaa83d3ba11d7a4487d42d2016b20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?xml version="1.0" encoding="utf-8"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">


  <!-- defines the layout master -->
  <fo:layout-master-set>
    <fo:simple-page-master master-name="first" 
                           page-height="29.7cm" 
                           page-width="21cm" 
                           margin-top="1cm" 
                           margin-bottom="2cm" 
                           margin-left="2.5cm" 
                           margin-right="2.5cm">
      <fo:region-body margin-top="3cm" margin-bottom="1.5cm"/>
      <fo:region-before extent="3cm"/>
      <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>

  <!-- starts actual layout -->
  <fo:page-sequence master-reference="first">

  <fo:flow flow-name="xsl-region-body">

    <!-- normal text -->
    <fo:block space-after="1cm" text-align="start" padding="0.4in"
	border="thick solid red">Table unit tests</fo:block>
    <fo:table border-collapse="collapse" width="6in">
      <fo:table-column column-width="(4.5in - 2cm) div 3 +1in" background-color="yellow"/>
      <fo:table-column column-width="(4.5in - 2cm) div 3 + 0.5in" background-color="blue"/>
      <fo:table-column column-width="(4.5in - 2cm) div 3 + 2.0cm" background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>fixed width columns</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
    <!-- table start -->
    <fo:table border-collapse="collapse" width="6in">
      <fo:table-column column-width="1in + proportional-column-width(1)" background-color="yellow"/>
      <fo:table-column column-width="2 * (proportional-column-width(1) + .5in) div 2" background-color="blue"/>
      <fo:table-column column-width="proportional-column-width(1) + 2.0cm" background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
        <fo:table-row>
          <fo:table-cell  background-color="blue"><fo:block>default alignment
</fo:block></fo:table-cell>
          <fo:table-cell height="3cm" background-color="green" display-align="center"><fo:block>Centered with height=3cm</fo:block></fo:table-cell>
          <fo:table-cell  background-color="yellow" display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
        <fo:table-row height="3cm">
          <fo:table-cell><fo:block>default alignment but with a height
of 3cm on the row </fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
<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>
    <!-- table start -->
    <fo:table border-collapse="collapse" width="100%">
      <fo:table-column background-color="yellow"/>
      <fo:table-column background-color="blue"/>
      <fo:table-column background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>

<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>
    <!-- table start -->
    <fo:table border-collapse="collapse" inline-progression-dimension="12cm"
	inline-progression-dimension.maximum="100%">
      <fo:table-column column-width="8cm" background-color="yellow"/>
      <fo:table-column column-width="proportional-column-width(2)" background-color="blue"/>
      <fo:table-column column-width="5cm" background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table><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>
    <!-- table start -->
    <fo:table border-collapse="collapse" inline-progression-dimension="14cm"
	inline-progression-dimension.maximum="100%">
      <fo:table-column column-width="8.5cm" background-color="yellow"/>
      <fo:table-column column-width="proportional-column-width(2)" background-color="blue"/>
      <fo:table-column column-width="8cm" background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
<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>
    <!-- table start -->
    <fo:table border-collapse="collapse" width="70% + 1cm">
      <fo:table-column column-width="from-parent('width') div 3" background-color="yellow"/>
      <fo:table-column background-color="blue"/>
      <fo:table-column background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>

<fo:block space-before="12pt" space-after="6pt">
The next table specifies inline-progression-dimension="15cm" instead of width. The
middle column has a fixed width; the other two have default width.
</fo:block>
    <!-- table start -->
    <fo:table border-collapse="collapse"
	inline-progression-dimension="15cm">
      <fo:table-column background-color="yellow"/>
      <fo:table-column column-width="3cm" background-color="blue"/>
      <fo:table-column background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>

<fo:block space-before="12pt" space-after="6pt">
The next table specifies neither width nor inline-progression-dimenion.
</fo:block>
    <!-- table start -->
    <fo:table table-layout="fixed" border-collapse="collapse">
      <fo:table-column background-color="yellow"/>
      <fo:table-column column-width="3cm" background-color="blue"/>
      <fo:table-column background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>

<fo:block space-before="12pt" space-after="6pt">
The next table specifies inline-progression-dimenion.minimum="10cm" and
specifies a column width of 5cm on the middle column only..
</fo:block>
    <!-- table start -->
    <fo:table table-layout="fixed" border-collapse="collapse"
	inline-progression-dimension.minimum="10cm">
      <fo:table-column background-color="yellow"/>
      <fo:table-column column-width="5cm" background-color="blue"/>
      <fo:table-column background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
<fo:block space-before="12pt" space-after="6pt">
The next table specifies inline-progression-dimenion.minimum="10cm",
inline-progression-dimension.maximum="17cm and
specifies a column width of 5cm on the middle column only..
</fo:block>
    <!-- table start -->
    <fo:table table-layout="fixed" border-collapse="collapse"
	inline-progression-dimension.minimum="10cm"
	inline-progression-dimension.maximum="17cm">
      <fo:table-column background-color="yellow"/>
      <fo:table-column column-width="5cm" background-color="blue"/>
      <fo:table-column background-color="green"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell display-align="before"><fo:block>Some text to make this cell 
deeper than the others to check out the aliignment properties.</fo:block></fo:table-cell>
          <fo:table-cell display-align="center"><fo:block>Centered</fo:block></fo:table-cell>
          <fo:table-cell display-align="after"><fo:block>Bottom aligned</fo:block></fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>


    </fo:flow>
  </fo:page-sequence>
</fo:root>