com.lowagie.text.pdf

## Class PdfTable

- java.lang.Object
- - com.lowagie.text.Rectangle
  - - com.lowagie.text.pdf.PdfTable

- All Implemented Interfaces:
    Element

      public class PdfTable
      extends Rectangle

  `PdfTable` is an object that contains the graphics and text of a table.
  See Also:
    `Table`, `Row`, `Cell`, `PdfCell`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.util.ArrayList` | `cells` this is the ArrayList with all the cells in the table.
    `private int` | `columns` this is the number of columns in the table.
    `private java.util.ArrayList` | `headercells` this is the ArrayList with all the cell of the table header.
    `protected float[]` | `positions` Cached column widths.
    `protected Table` | `table` Original table used to build this object

    - ### Fields inherited from class com.lowagie.text.Rectangle

      `backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders`

    - ### Fields inherited from interface com.lowagie.text.Element

      `ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PdfTable(Table table, float left, float right, float top)` Constructs a `PdfTable`-object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) float` | `cellpadding()` Returns the cellpadding of the table.
    `(package private) float` | `cellspacing()` Returns the cellspacing of the table.
    `(package private) int` | `columns()` Returns the number of columns of the table.
    `(package private) java.util.ArrayList` | `getCells()` Returns the arraylist with the cells of the table.
    `(package private) java.util.ArrayList` | `getHeaderCells()` Returns the arraylist with the cells of the table header.
    `float` | `getOffset()` Gets the offset of this table.
    `(package private) boolean` | `hasHeader()` Checks if there is a table header.
    `boolean` | `hasToFitPageCells()` Checks if the cells of this `Table` have to fit a page.
    `boolean` | `hasToFitPageTable()` Checks if this `Table` has to fit a page.
    `(package private) int` | `rows()` Get the number of rows
    `int` | `type()` Gets the type of the text element.
    `(package private) void` | `updateRowAdditions()` Updates the table row additions in the underlying table object and deletes all table rows, in order to preserve memory and detect future row additions.
    `private void` | `updateRowAdditionsInternal()` Updates the table row additions in the underlying table object

    - ### Methods inherited from class com.lowagie.text.Rectangle

      `cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRight, getRight, getRotation, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isNestable, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### columns

          private int columns

      this is the number of columns in the table.

    - #### headercells

          private java.util.ArrayList headercells

      this is the ArrayList with all the cell of the table header.

    - #### cells

          private java.util.ArrayList cells

      this is the ArrayList with all the cells in the table.

    - #### table

          protected Table table

      Original table used to build this object

    - #### positions

          protected float[] positions

      Cached column widths.

  - ### Constructor Detail

    - #### PdfTable

          PdfTable(Table table,
                  float left,
                  float right,
                  float top)

      Constructs a `PdfTable`-object.
      Parameters:
        `table` - a `Table`
        `left` - the left border on the page
        `right` - the right border on the page
        `top` - the start position of the top of the table
      Since:
        a parameter of this method has been removed in iText 2.0.8

  - ### Method Detail

    - #### updateRowAdditions

          void updateRowAdditions()

      Updates the table row additions in the underlying table object and deletes all table rows, in order to preserve memory and detect future row additions.

      Pre-requisite: the object must have been built with the parameter `supportUpdateRowAdditions` equals to true.

    - #### updateRowAdditionsInternal

          private void updateRowAdditionsInternal()

      Updates the table row additions in the underlying table object

    - #### rows

          int rows()

      Get the number of rows

    - #### type

          public int type()

      Description copied from class: `Rectangle`
      Gets the type of the text element.
      Specified by:
        `type` in interface `Element`
      Overrides:
        `type` in class `Rectangle`
      Returns:
        a type
      See Also:
        `Element.type()`

    - #### getHeaderCells

          java.util.ArrayList getHeaderCells()

      Returns the arraylist with the cells of the table header.
      Returns:
        an `ArrayList`

    - #### hasHeader

          boolean hasHeader()

      Checks if there is a table header.
      Returns:
        an `ArrayList`

    - #### getCells

          java.util.ArrayList getCells()

      Returns the arraylist with the cells of the table.
      Returns:
        an `ArrayList`

    - #### columns

          int columns()

      Returns the number of columns of the table.
      Returns:
        the number of columns

    - #### cellpadding

          final float cellpadding()

      Returns the cellpadding of the table.
      Returns:
        the cellpadding

    - #### cellspacing

          final float cellspacing()

      Returns the cellspacing of the table.
      Returns:
        the cellspacing

    - #### hasToFitPageTable

          public final boolean hasToFitPageTable()

      Checks if this `Table` has to fit a page.
      Returns:
        true if the table may not be split

    - #### hasToFitPageCells

          public final boolean hasToFitPageCells()

      Checks if the cells of this `Table` have to fit a page.
      Returns:
        true if the cells may not be split

    - #### getOffset

          public float getOffset()

      Gets the offset of this table.
      Returns:
        the space between this table and the previous element.