# Elementname: `Td`

CSS name: td

## Description

Td wraps a table cell, just like HTML.

Allowed attributes: align, background-font-family, background-size, background-text, background-textcolor, background-transform, backgroundcolor, border-bottom, border-bottom-color, border-left, border-left-color, border-right, border-right-color, border-top, border-top-color, class, colspan, id, padding, padding-bottom, padding-left, padding-right, padding-top, rowspan, valign

Child elements: Barcode, Box, Copy-of, ForAll, Frame, Groupcontents, Image, Loop, Overlay, Paragraph, Switch, Table, VSpace

Parent elements: Case, ForAll, Loop, Otherwise, SetVariable, Tr, Until, While

### Attributes

align (optional, CSS property: text-align)

  Horizontal alignment of the cell contents. Defaults to left.

  left: | The contents is left aligned (ragged right). This is the default.
  right: | The contents of the cell is right aligned.
  center: | The contents of the cell is aligned at the center, with ragged right and left margin.
  justify: | Justified text with straight margins.

background-font-family (text, optional, CSS property: background-font-family, since version 2.3.7)

  Set the font family of the background text. Defaults to the table font.

background-size (optional, CSS property: background-size, since version 2.3.7)

  Controls the size of the background text. Currently only 'contain' and 'auto' is allowed.

  contain: | Fill the height of the table cell.
  auto: | The background text is not scaled.

background-text (optional, CSS property: background-text, since version 2.3.7)

  A text that should be placed in the background of the table cell.

background-textcolor (optional, CSS property: background-textcolor, since version 2.3.7)

  The color of the text in the background (if any).

background-transform (optional, CSS property: background-transform, since version 2.3.7)

  The transformation of the background text (if any). Currently supported: `rotate(-40deg)` (and other angles in the range 0 to -90).

backgroundcolor (text, optional, CSS property: background-color)

  The name of the background color (if the cell should get a background).

border-bottom (length, optional, CSS property: border-bottom-width)

  The width (thickness) of the bottom border. The border is inside the cell.

border-bottom-color (text, optional, CSS property: border-bottom-color)

  The color of the bottom border.

border-left (length, optional, CSS property: border-left-width)

  The width (thickness) of the left border. The border is inside the cell.

border-left-color (text, optional, CSS property: border-left-color)

  The color of the left border.

border-right (length, optional, CSS property: border-right-width)

  The width (thickness) of the right border. The border is inside the cell.

border-right-color (text, optional, CSS property: border-right-color)

  The color of the left border.

border-top (length, optional, CSS property: border-top-width)

  The width (thickness) of the top border. The border is inside the cell.

border-top-color (text, optional, CSS property: border-top-color)

  The color of the top border.

class (text, optional)

  The css class to be used for formatting the table cell.

colspan (number, optional)

  The number of columns this cell spans. Defaults to 1.

id (text, optional)

  CSS id for this table cell.

padding (length, optional, CSS property: padding)

  Shorthand for setting padding-top and the other values with this length.

padding-bottom (length, optional, CSS property: padding-bottom)

  Set the inner distance (width between contents and the border) to the bottom edge.

padding-left (length, optional, CSS property: padding-left)

  Set the inner distance (width between contents and the border) to the left edge.

padding-right (length, optional, CSS property: padding-right)

  Set the inner distance (width between contents and the border) to the right edge.

padding-top (length, optional, CSS property: padding-top)

  Set the inner distance (width between contents and the border) to the top edge.

rowspan (number, optional)

  The number of rows for this cell. Defaults to 1.

valign (optional, CSS property: vertical-align)

  The vertical alignment of the cell.

  top: | The contents is aligned at the top edge of the cell.
  middle: | The contents is vertically centered.
  bottom: | The contents is aligned at the bottom edge of the cell.

### Remarks

The child elements of the table cells are either block objects that start a new line or inline objects that are placed horizontally next to each other (from left to right) until the width of the table cell forces a line break. Block objects are Paragraph, Table and Box, inline objects are Barcode and Image.

## Example

The following example places a background text behind the Td cell.

    <DefineFontfamily name="td-background" fontsize="12" leading="12">
      <Regular fontface="TeXGyreHeros-Bold"/>
    </DefineFontfamily>

    <Record element="data">
       <PlaceObject>
         <Table stretch="max">
           <Columns>
             <Column width="5cm"/>
           </Columns>
           <Tr>
             <Td border-top="0.25pt" border-bottom="0.25pt"
                background-text="hello!"
                background-textcolor="goldenrod"
                background-transform="rotate(-30deg)"
                background-size="contain"
                background-font-family="td-background">
               <Paragraph><Value>A wonderful serenity has taken possession of my entire soul,
                 like these sweet mornings of spring which I enjoy with my whole heart.</Value>
               </Paragraph>
             </Td>
           </Tr>
         </Table>
       </PlaceObject>
    </Record>

## See also

Table, Tr, Paragraph, Image, Stylesheet

# 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