Chapter 13: Using tables
13.1. Block tables
<blockTable>
<tr>
<td>This</td><td>is</td>
</tr>
<tr>
<td>a</td><td>blockTable.</td>
</tr>
</blockTable>
This | is |
a | blockTable. |
|
|
|
|
<blockTable rowHeights="1.25cm,1.25cm" colWidths="4cm,4cm" >
<tr>
<td> <para>This is a <b>more</b> complex <font color="red">blockTable</font>.</para> </td>
<td> <para>This is a more <i>complex</i> blockTable.</para> </td>
</tr>
<tr>
<td> <para><font face="Helvetica">This is a more complex blockTable.</font></para> </td>
<td> <para>This is <greek>a</greek> more <font color="blue"><i>complex</i></font> blockTa<greek>b</greek>le.</para> </td>
</tr>
</blockTable>
13.2. Block table attributes
13.3. Block table styles
A radius of 0 is square and missing trailing values are assumed 0.
The radius actually used will be the minimum of the corner cell width/height and the requested radius.
Border lines passing through the exact corners are curved an octant at each corner.
13.4. More about block tables
A couple of cautions about blockTables
13.5. Using block table styles
Example 10 - Colors and fonts in tables
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE document SYSTEM "../rml.dtd">
<document filename="example_10.pdf">
<template>
<pageTemplate id="main">
<pageGraphics>
</pageGraphics>
<frame id="first" x1="72" y1="72" width="451" height="698"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="myBlockTableStyle">
<!-- This sets a font for every cell from the start of the
second row down to the bottom right hand corner -->
<blockFont name="Courier-Bold" start="0,1" stop="-1,-1"/>
<!-- This sets a font for the first row -->
<blockFont name="Helvetica-BoldOblique" size="24" start="0,0" stop="3,0"/>
<!-- This sets a textColor for all the text in the table -->
<blockTextColor colorName="black"/>
<!-- This sets a textColor for the first row -->
<!-- (Since it comes after the above setting, -->
<!-- it overides it for this row) -->
<blockTextColor colorName="white" start="0,0" stop="3,0"/>
<!-- This sets a textColor a column - also overiding -->
<!-- the first textColor setting for this row -->
<blockTextColor colorName="blue" start="1,1" stop="1,6"/>
<!-- This sets a background color for the first row -->
<blockBackground colorName="red" start="0,0" stop="3,0"/>
<!-- This sets a background color for the rest of the table -->
<blockBackground colorName="cornsilk" start="0,1" stop="-1,-1"/>
<!-- This sets a background color for an individual cell -->
<!-- This has to go AFTER the above blockBackground, -->
<!-- otherwise it would be overpainted by the cornsilk color -->
<blockBackground colorName="lightcoral" start="3,3" stop="3,3"/>
</blockTableStyle>
</stylesheet>
<story>
<title>Example 10 - colors and fonts in tables</title>
<spacer length = "1cm"/>
<blockTable style="myBlockTableStyle"
rowHeights="3.5cm,2cm,2cm,2cm,2cm,2cm,2cm"
colWidths="4cm,4cm,4cm,4cm"
>
<tr><td>Cell 0,0</td><td>Cell 1,0</td><td>Cell 2,0</td><td>Cell 3,0</td></tr>
<tr><td>Cell 0,1</td><td>Cell 1,1</td><td>Cell 2,1</td><td>Cell 3,1</td></tr>
<tr><td>Cell 0,2</td><td>Cell 1,2</td><td>Cell 2,2</td><td>Cell 3,2</td></tr>
<tr><td>Cell 0,3</td><td>Cell 1,3</td><td>Cell 2,3</td><td>Cell 3,3</td></tr>
<tr><td>Cell 0,4</td><td>Cell 1,4</td><td>Cell 2,4</td><td>Cell 3,4</td></tr>
<tr><td>Cell 0,5</td><td>Cell 1,5</td><td>Cell 2,5</td><td>Cell 3,5</td></tr>
<tr><td>Cell 0,6</td><td>Cell 1,6</td><td>Cell 2,6</td><td>Cell 3,6</td></tr>
</blockTable>
</story>
</document>
Example 10 - colors and fonts in tables
Colors and fonts in table cells
<blockTable colWidths="5cm,5cm" style="myBlockTableStyle1">
<tr><td>fontName</td><td fontName="Courier">Courier</td></tr>
<tr><td>fontName</td><td fontName="Helvetica">Helvetica</td></tr>
<tr><td>fontSize</td><td fontSize="8">8</td></tr>
<tr><td>fontSize</td><td fontSize="14">14</td></tr>
<tr><td>fontColor</td><td fontColor="red">red</td></tr>
<tr><td>fontColor</td><td fontColor="blue">blue</td></tr>
<tr><td>leading</td><td leading="16">leading
is
16</td></tr>
<tr><td>leading</td><td leading="12">leading
is
12</td></tr>
<tr><td>leftPadding</td><td leftPadding="10">10</td></tr>
<tr><td>leftPadding</td><td leftPadding="16">16</td></tr>
<tr><td>rightPadding</td><td rightPadding="10" align="right">10</td></tr>
<tr><td>rightPadding</td><td rightPadding="24" align="right">24</td></tr>
<tr><td>topPadding</td><td topPadding="10">10</td></tr>
<tr><td>topPadding</td><td topPadding="24">24</td></tr>
<tr><td>bottomPadding</td><td bottomPadding="10">10</td></tr>
<tr><td>bottomPadding</td><td bottomPadding="24">24</td></tr>
<tr><td>background</td><td background="pink">pink</td></tr>
<tr><td>background</td><td background="lightblue">lightblue</td></tr>
<tr><td>align</td><td align="left">left</td></tr>
<tr><td>align</td><td align="center">center</td></tr>
<tr><td>align</td><td align="right">right</td></tr>
<tr><td>-
vAlign
-</td><td vAlign="top">top</td></tr>
<tr><td>-
vAlign
-</td><td vAlign="middle">middle</td></tr>
<tr><td>-
vAlign
-</td><td vAlign="bottom">bottom</td></tr>
</blockTable>
produces
Figure
Example 11 - lines and alignment in tables
<document filename="example_11.pdf">
<template>
<pageTemplate id="main">
<pageGraphics>
</pageGraphics>
<frame id="first" x1="72" y1="72" width="451" height="698"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="myBlockTableStyle">
<!-- Set fonts -->
<blockFont name="Courier-Bold" size="10" start="0,1" stop="-1,-1"/>
<blockFont name="Helvetica-BoldOblique" size="10" start="0,0" stop="3,0"/>
<!-- This sets a textColor for all the text in the table -->
<blockTextColor colorName="black"/>
<!-- Another example of blockTextColor -->
<blockTextColor colorName="green" start="2,2" stop="3,3"/>
<!-- This sets a blockAlignment for the whole table -->
<blockAlignment value="CENTER"/>
<!-- These overrides the above -->
<blockAlignment value="RIGHT" start="3,0" stop="3,-1"/>
<blockAlignment value="LEFT" start="0,1" stop="0,-1"/>
<!-- This sets the vertical alignment for one row -->
<blockValign value="TOP" start="0,0" stop="-1,0"/>
<!-- This sets the vertical alignment for one cell -->
<blockValign value="MIDDLE" start="2,2" stop="2,2"/>
<!-- Use of linestyles -->
<lineStyle kind="GRID" colorName="silver"/>
<lineStyle kind="LINEBELOW" colorName="orangered" start="0,0"
stop="-1,0" thickness="5"/>
<lineStyle kind="LINEAFTER" colorName="maroon" start="1,1"
stop="1,6" thickness="1"/>
</blockTableStyle>
</stylesheet>
<story>
<title>Example 11 - lines and alignment in tables</title>
<spacer length="1cm"/>
<blockTable style="myBlockTableStyle"
rowHeights="2cm,2cm,2cm,2cm,2cm,2cm,2cm"
colWidths="4cm,3cm,3cm,4cm"
>
<tr>
<td>(a=LEFT)(VA=TOP)</td>
<td>(VA=TOP)</td>
<td>(VA="TOP")</td>
<td>(a=RIGHT)(VA=TOP)</td>
</tr>
<tr>
<td>(a=LEFT)</td>
<td>1,1</td>
<td>Cell 2,1</td>
<td>(a=RIGHT)</td>
</tr>
<tr>
<td>(a=LEFT)</td>
<td>1,2</td>
<td>(VA=MIDDLE)</td>
<td>(a=RIGHT)</td>
</tr>
<tr>
<td>(a=LEFT)</td>
<td>1,3</td>
<td>(VA=MIDDLE)</td>
<td>(VA=MDL)(a=RIGHT)</td>
</tr>
<tr>
<td>(a=LEFT)</td>
<td>1,4</td>
<td>2,4</td>
<td>(a=RIGHT)</td>
</tr>
<tr>
<td>(a=LEFT)</td>
<td>1,5</td>
<td>2,5</td>
<td>(a=RIGHT)</td>
</tr>
<tr>
<td>(a=LEFT)</td>
<td>1,6</td>
<td>2,6</td>
<td>(a=RIGHT)</td>
</tr>
</blockTable>
<spacer length="15"/>
<para>a=value for <i>blockAlignment</i></para>
<para>VA=value for <i>blockValign</i></para>
<para><i>MDLE=MIDDLE for VA in cells 3,2 and 3,3</i></para>
</story>
</document>
Example 11 - lines and alignment in tables
<blockTable style="myBlockTableStyle2"
rowHeights="2cm,2cm,2cm,2cm,2cm,2cm,2cm"
colWidths="4cm,3cm,3cm,4cm" >
<tr><td>(a=LEFT)(VA=TOP)</td><td>(VA=TOP)</td><td>(VA="TOP")</td><td>(a=RIGHT)(VA=TOP)</td></tr>
<tr><td>(a=LEFT)</td><td>1,1</td><td>Cell 2,1</td><td>(a=RIGHT)</td></tr>
<tr><td>(a=LEFT)</td><td>1,2</td><td>(VA=MIDDLE)</td><td>(VA=MDL)(a=RIGHT)</td></tr>
<tr><td>(a=LEFT)</td><td>1,3</td><td>(VA=MIDDLE)</td><td>(VA=MDL)(a=RIGHT)</td></tr>
<tr><td>(a=LEFT)</td><td>1,4</td><td>2,4</td><td>(a=RIGHT)</td></tr>
<tr><td>(a=LEFT)</td><td>1,5</td><td>2,5</td><td>(a=RIGHT)</td></tr>
<tr><td>(a=LEFT)</td><td>1,6</td><td>2,6</td><td>(a=RIGHT)</td></tr>
</blockTable>
Figure 23: Output table from EXAMPLE 11
Example 12 - images and padding in tables
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE document SYSTEM "rml.dtd">
<document filename="example_12.pdf">
<template>
<pageTemplate id="main">
<pageGraphics>
</pageGraphics>
<frame id="first" x1="72" y1="72" width="451" height="698"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="myBlockTableStyle">
<blockBackground colorName="silver" start="0,0" stop="-1,0"/>
<blockBackground colorName="darkslategray" start="0,1" stop="-1,1"/>
<blockBackground colorName="silver" start="0,2" stop="-1,2"/>
<blockBackground colorName="darkslategray" start="0,3" stop="-1,3"/>
<blockBackground colorName="silver" start="0,4" stop="-1,4"/>
<blockBackground colorName="darkslategray" start="0,5" stop="-1,5"/>
<blockAlignment value="CENTER"/>
<blockValign value="MIDDLE"/>
<!-- Set fonts -->
<blockFont name="Helvetica-BoldOblique" size="10"/>
<!-- set the left and right padding for cells in first and -->
<!-- third columns remember, cell numbering starts from ZERO, not ONE -->
<blockLeftPadding length="20" start="0,0" stop="0,-1"/>
<blockRightPadding length="20" start="2,0" stop="2,-1"/>
<!-- set the top and bottom padding for cells in first and third rows -->
<blockBottomPadding length="40" start="0,0" stop="-1,0"/>
<blockTopPadding length="40" start="0,2" stop="-1,2"/>
<!-- set the top and bottom padding for the last row -->
<blockBottomPadding length="40" start="-1,4" stop="-1,4"/>
<blockTopPadding length="40" start="0,4" stop="0,4"/>
<!-- Use of linestyles -->
<lineStyle kind="GRID" colorName="darkblue"/>
</blockTableStyle>
<paraStyle name="paddingTableStyle"
fontName="Helvetica-BoldOblique"
fontSize="10"
textColor="white"
alignment="CENTER"
/>
</stylesheet>
<story>
<title>Example 12 - images and padding in tables</title>
<spacer length="1cm"/>
<blockTable style="myBlockTableStyle"
rowHeights="166,28,166,28,166,28"
colWidths="161,161,161"
>
<tr>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
</tr>
<tr>
<td>
<para style="paddingTableStyle">
<b>blockLeftPadding</b> with <b>blockBottomPadding
</para>
</td>
<td>
<para style="paddingTableStyle">
just blockBottomPadding
</para>
</td>
<td>
<para style="paddingTableStyle">
<b>blockRightPadding</b> with <b>blockBottomPadding</b>
</para>
</td>
</tr>
<tr>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
</tr>
<tr>
<td>
<para style="paddingTableStyle">
<b>blockLeftPadding</b> with <b>blockTopPadding
</para>
</td>
</td>
<td>
<para style="paddingTableStyle">
just blockTopPadding
</para>
</td>
<td>
<para style="paddingTableStyle">
<b>blockRightPadding</b> with <b>blockTopPadding</b>
</para>
</td>
</tr>
<tr>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
<td>
<illustration width="141" height="90">
<image file="images/replogo.gif"
x="0" y="0"
width="141" height="90"/>
<stroke color="deepskyblue"/>
<lineMode width="3"/>
<lines>
0 0 141 0
141 0 141 90
141 90 0 90
0 90 0 0
</lines>
</illustration>
</td>
</tr>
<tr>
<td>
<para style="paddingTableStyle">
blockLeftPadding with blockTopPadding
</para>
</td>
<td>
<para style="paddingTableStyle">
no padding
</para>
</td>
<td>
<para style="paddingTableStyle">
blockRightPadding with blockBottomPadding
</para>
</td>
</tr>
</blockTable>
</story>
</document>
Figure