<table> (Template Tag)


Description


A table is a grid object composed of rows and columns. Rows and columns form table cells.

A table is used to present data in grids. A table can be nested in another one. The tag defines the table.


Example


 <?xml version="1.0" encoding="utf-8"?>

 <assembly id="nxm.tests.basic.pl">

. . .

Example 1 (known number of lines):

. . .

 <document>

   <section width="21.0" height="29.7">

     <table>

       <columns>

         <column width="1.0"></column>

         <column width="6.0"></column>

       </columns>

       <row>

         <cell>

           <text>No</text>

         </cell>

         <cell>

           <text>Index</text>

         </cell>

       </row>

     </table>

   </section>

 </document>

. . .


Prints a table with two columns (1cm and 6cm wide) and one row.

Example 2 (unknown number of lines):

. . .

 <document>

   <section width="21.0" height="29.7">

     <table style="small;debug">

       <columns>

         <column width="1.0"></column>

         <column width="6.0"></column>

       </columns>

       <header style="table_header">

         <row>

           <cell>

             <text>No</text>

           </cell>

           <cell>

             <text>Index</text>

           </cell>

         </row>

       </header>

       <page-header style="table_header">

         <row>

           <cell>

             <text>No</text>

           </cell>

           <cell>

             <text>Index</text>

           </cell>

         </row>

       </page-header>

       <repeater input="lines">

         <row>

         <cell>

           <text>No</text>

         </cell>

         <cell>

           <text>Index</text>

         </cell>

         </row>

       </repeater>

       <page-footer style="table_footer">

         <row>

           <cell>

             <text>Lens</text>

           </cell>

           <cell>

             <text>Sum of fields</text>

           </cell>

         </row>

       </footer>

       <page-footer style="table_footer">

         <row>

           <cell>

             <text>Lens</text>

           </cell>

           <cell>

             <text>Sum of fields</text>

           </cell>

         </row>

       </footer>

     </table>

   </section>

 </document>

. . .

 </assembly>




The code prints a table with two columns (1cm and 6cm wide) and a number of rows depending on the "lines" object. At the beginning it prints the table header and the header on each page. At the end it prints the footer and the page-footers on each page where the rows of the table will be printed.


Attributes



Attribute

Description

style

A name of an element’s style. If you want to apply multiple styles in an element, enter the styles’ names separated by semicolon.



Child elements permitted



Child element

Description

columns

Defines the parameters of the columns in the table

header

Defines the table header, i.e. the names of individual columns and a possible spanning the columns i.e. colspan.

footer

Defines the footer of the table, such as sums of the columns’ values.

page-header

Defines the header of the table, i.e. the names of individual columns and a possible spanning the columns i.e. colspan. The page-header is repeated on each page.

page-footer

Defines the footer of the table, such as sums of the columns’ values. The page-footer is repeated on each page.

repeater

Creates a loop that generates the next rows of the table and the rows’ content

row

Defines a specific table rows



Parent elements permitted


Like in the <content> tag.