# Elementname: `Table`

## Description

Create a table that is similar to the HTML table model.

Allowed attributes: balance, border-collapse, columndistance, eval, fontface, leading, padding, stretch, width

Child elements: Columns, Copy-of, ForAll, Loop, Message, Switch, Tablefoot, Tablehead, Tablerule, Tr

Parent elements: Case, ForAll, Frame, Loop, Otherwise, Overlay, PlaceObject, Position, Td, Transformation, Until, While

### Attributes

balance (optional, since version 3.1.24)

  Tries to balance the table on the last page according to the number of frames. Experimental!

  yes: | Tries to balance.
  no: | First column will filled first, default

border-collapse (optional)

  Determine if adjacent table cells share borders. The behavior of border-collapse="collapse" is undefined when the table has columndistance or rowdistance set to a non-zero value and if the adjacent borders don't have the same width and color.

  separate: | The borders are part of the cell and not shared with its neighbors.
  collapse: | The borders of neighboring cells overlap.

columndistance (length, optional)

  Distance between two table columns.

eval (XPath Expression, optional)

  Evaluates the given XPath expression and discards its output.

fontface (text, optional)

  Name of the font family for the table. If not given, the font face ‘text’ is used.

leading (length, optional)

  The distance between two rows.

padding (length, optional)

  The distance between the table border and the table contents.

stretch (optional)

  If the table contents is narrow and stretch has the value no, the table only uses the minimal width. If the table contents is wider than the value width or stretch has the value max, the table's width is the size given in the width attribute.

  max: | Stretch the table to its given width.
  no: | The table width is the minimum width depending on it's contents.

width (number or length, optional)

  The maximum width of the table (in grid cells or absolute values). Defaults to the available space.

### Remarks

The table cells may contain Paragraphs, Images and other objects that are allowed in PlaceObject.

## Example

    <Record element="data">
      <PlaceObject>
        <Table stretch="max" padding="1pt">
          <Tablehead>
            <Tr backgroundcolor="gray">
              <Td colspan="3"/>
              <Td border-left="0.2pt" border-left-color="white" colspan="6" align="center">
                <Paragraph><B><Value>Total</Value></B></Paragraph></Td>
              <Td border-left="0.2pt" border-left-color="white"/>
            </Tr>
            <Tr backgroundcolor="gray">
              <Td/>
              <Td><Paragraph><B><Value>Clubs</Value></B></Paragraph></Td>
              <Td><Paragraph><B><Value>P</Value></B></Paragraph></Td>
              <Td align="center" border-left="0.2pt" border-left-color="white">
                <Paragraph><B><Value>W</Value></B></Paragraph>
              </Td>
              <Td align="center"><Paragraph><B><Value>D</Value></B></Paragraph></Td>
              <Td align="center"><Paragraph><B><Value>L</Value></B></Paragraph></Td>
              <Td align="center"><Paragraph><B><Value>F</Value></B></Paragraph></Td>
              <Td align="center"><Paragraph><B><Value>A</Value></B></Paragraph></Td>
              <Td align="center"><Paragraph><B><Value>+/-</Value></B></Paragraph></Td>
              <Td align="center" border-left="0.2pt" border-left-color="white">
                <Paragraph><B><Value>Pts</Value></B></Paragraph>
              </Td>
            </Tr>
          </Tablehead>
          <ForAll select="entry">
            <Tr>
              <Td align="left"><Paragraph><Value select="@pos"/></Paragraph></Td>
              <Td align="left"><Paragraph><Value select="@name"/></Paragraph></Td>
              <Td align="center"><Paragraph><Value select="@p"/></Paragraph></Td>
              <Td align="center" border-left="0.2pt" border-left-color="gray">
                <Paragraph><Value select="@tw"/></Paragraph>
              </Td>
              <Td align="center"><Paragraph><Value select="@td"/></Paragraph></Td>
              <Td align="center"><Paragraph><Value select="@tl"/></Paragraph></Td>
              <Td align="center"><Paragraph><Value select="@ta"/></Paragraph></Td>
              <Td align="center"><Paragraph><Value select="@tf"/></Paragraph></Td>
              <Td align="center"><Paragraph><Value select="@tpm"/></Paragraph></Td>
              <Td align="center" border-left="0.2pt" border-left-color="gray">
                <Paragraph><Value select="@pts"/></Paragraph>
              </Td>
            </Tr>
          </ForAll>
        </Table>
      </PlaceObject>
    </Record>

Using the following data:

    <data>
      <entry pos="1" name="Paris Saint-Germain FC" p="6"
      	  tw="5" td="0" tl="1" tf="14" ta="3" tpm="11" pts="15" />
      <entry pos="2" name="FC Porto" p="6"
      	  tw="4" td="1" tl="1" tf="10" ta="4" tpm="6" pts="13" />
      <entry pos="3" name="FC Dynamo Kyiv" p="6"
      	  tw="1" td="2" tl="3" tf="6"  ta="10" tpm="-4" pts="5" />
      <entry pos="4" name="GNK Dinamo Zagreb" p="6"
      	  tw="0" td="1" tl="5" tf="1"  ta="14" tpm="-13" pts="1" />
    </data>

## See also

Tr, Td, Tablerule, PlaceObject

# Commands

- A
- Action
- AddSearchpath
- AtPageCreation
- AtPageShipout
- AttachFile
- Attribute
- B
- Barcode
- Bold
- BoldItalic
- Bookmark
- Box
- Br
- Case
- Circle
- Color
- Column
- Columns
- Compatibility
- Contents
- Copy-of
- DefineColor
- DefineFontalias
- DefineFontfamily
- DefineTextformat
- Element
- Fontface
- ForAll
- Frame
- Grid
- Group
- Groupcontents
- HSpace
- Hyphenation
- I
- Image
- Include
- Initial
- InsertPages
- Italic
- Layout
- Li
- LoadDataset
- LoadFontfile
- Loop
- Makeindex
- Margin
- Mark
- Message
- NewPage
- NextFrame
- NextRow
- NoBreak
- Ol
- Options
- Otherwise
- Output
- Overlay
- PDFOptions
- Pageformat
- Pagetype
- Paragraph
- PlaceObject
- Position
- PositioningArea
- PositioningFrame
- ProcessNode
- Record
- Regular
- Rule
- SaveDataset
- SavePages
- SetGrid
- SetVariable
- SortSequence
- Span
- Stylesheet
- Sub
- Sup
- Switch
- Table
- Tablefoot
- Tablehead
- Tablerule
- Td
- Text
- Textblock
- Tr
- Trace
- Transformation
- U
- URL
- Ul
- Until
- VSpace
- Value
- While

Version: 3.2.0 | Start page | Command reference | Other language: German