<!-- chapterName "Lesson 8: Table Styles - pt. 1: the basics" -->

<codesnippet language="xml" style="code"><![CDATA[
<!DOCTYPE document SYSTEM "rml.dtd">
<document filename="example_08.pdf">

    <template showBoundary="1">
        <pageTemplate id="main">

            <pageGraphics>
                <place x="10" y="500" width="600" height="250">
                    <blockTable style="blocktablestyle1">
                        <tr>
                             <td>This table</td><td>is defined</td>
                        </tr>
                        <tr>
                             <td>inside a place tag in the graphics section,</td>
                             <td>
                                <para style="textstyle1">
                                    and can be styled using blockTableStyles
                                    and para tags.
                                </para>
                             </td>
                        </tr>
                    </blockTable>
                </place>
            </pageGraphics>

            <frame id="first" x1="100" y1="400" width="150" height="200"/>

        </pageTemplate>

    </template>

    <stylesheet>
        <!-- A blockTableStyle tag for styling a table-->
        <blockTableStyle id="blocktablestyle1">
            <blockFont name="Courier-Bold"/>
            <blockFont name="Helvetica-BoldOblique" size="8"/>
            <blockTextColor colorName="green"/>
        </blockTableStyle>
        <paraStyle name="textstyle1"
                   fontName="Helvetica"
                   fontSize="9"
                   textColor="blue"/>
    </stylesheet>

    <story> 
        
        <!-- a table styled using only blockTableStyle>-->
        <blockTable>
            <tr>
                <td><para textColor="green">A block</para></td>
                <td>table</td>
            </tr>
            <tr>
                <td>inside </td>
                <td>
                    the story tag.  This is a long string of text
                    which won't wrap by default.
                </td>
            </tr>
        </blockTable>
        
        <!-- a table styled using both blockTableStyle from -->
        <!-- the stylesheet, and parastyles in table cells. -->
        <blockTable style="blocktablestyle1">
            <tr>
                <td><para textColor="red">This is </para></td>
                <td>the same table</td>
            </tr>
            <tr>
                <td>but with</td>
                <td>
                    <para style="textstyle1">
                        &lt;para&gt; tags inside the table cells, so the
                        long string of text is wrapped!
                    </para>
                </td>
            </tr>
        </blockTable>

    </story>
</document>


]]></codesnippet>


<para>By default, as in example 7, tables are unstyled with invisible borders, and text doesn't wrap.  This is the default because it can be rendered very fast. However, styles can be applied to tables using the &lt;blockTableStyle&gt; tag in the &lt;stylesheet&gt; section.</para>

<para>You can also style the text in individual cells using &lt;para&gt; tags inside the &lt;td&gt; tags.</para>

<para>In this example, the table at the top right is from the &lt;pageGraphics&gt; section.  Because it is inside a set of &lt;place&gt; tags, it can use styles from the stylesheet in exactly the same way as a flowable element in the &lt;story&gt;.</para>

<para>The second table is a default, unstyled table.  Note that it's centred inside it's containing &lt;frame&gt; and the text doesn't wrap inside the cells.  It uses the default PDF styling.</para>

<para>The third table demonstrates the use of the &lt;blockTableStyle&gt; tag.  Again, it's centred inside it's containing &lt;frame&gt;, and the text doesn't wrap inside the cells; however, the text is styled according to "blocktablestyle1" which is defined in the stylesheet.</para>
<para>The third table also demonstrates how you can mix blockTableStyles and &lt;para&gt; tags.  The &lt;para&gt; tag in the bottom right cell causes the text to wrap.  You can use &lt;paraStyle&gt; tags from the stylesheet and override their properties in exactly the same way you would outside a table.</para>

