## com.lowagie.text
Class SimpleTable

    java.lang.Object
      com.lowagie.text.Rectangle
          com.lowagie.text.SimpleTable

All Implemented Interfaces:
  Element, MarkupAttributes, PdfPTableEvent, TextElementArray

    public class SimpleTable

extends Rectangle
implements PdfPTableEvent, Element, TextElementArray

Rectangle that can be used for Cells. This Rectangle is padded and knows how to draw itself in a PdfPTable or PdfPcellEvent.

Field Summary
`private int` `alignment` the alignment of the table.
`private float` `cellpadding` the padding of the Cells.
`private float` `cellspacing` the spacing of the Cells.
`private java.util.ArrayList` `content` the content of a Table.
`private float` `width` the width of the Table.
`private float` `widthpercentage` the widthpercentage of the Table.

Fields inherited from class com.lowagie.text.Rectangle
`background, border, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, color, LEFT, llx, lly, markupAttributes, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders`

Constructor Summary
`SimpleTable()` A RectangleCell is always constructed without any dimensions.

Method Summary
`boolean` `add(java.lang.Object o)` Adds an object to the `TextElementArray`.
`void` `addElement(SimpleCell element)` Adds content to this object.
`PdfPTable` `createPdfPTable()` Creates a PdfPTable object based on this TableAttributes object.
`Table` `createTable()` Creates a Table object based on this TableAttributes object.
`int` `getAlignment()`
`float` `getCellpadding()`
`float` `getCellspacing()`
`static SimpleTable` `getDimensionlessInstance(Rectangle rectangle, float spacing)`
`float` `getWidth()`
`float` `getWidthpercentage()`
`void` `setAlignment(int alignment)`
`void` `setCellpadding(float cellpadding)`
`void` `setCellspacing(float cellspacing)`
`void` `setWidth(float width)`
`void` `setWidthpercentage(float widthpercentage)`
`void` `tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases)` This method is called at the end of the table rendering.
`int` `type()` Gets the type of the text element.

Methods inherited from class com.lowagie.text.Rectangle

`backgroundColor, border, borderColor, borderWidth, bottom, bottom, cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getChunks, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, getRotation, grayFill, hasBorder, hasBorders, height, isUseVariableBorders, left, left, normalize, process, rectangle, right, right, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setMarkupAttribute, setMarkupAttributes, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, top, top, toString, width`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### content

    private java.util.ArrayList content

  the content of a Table.

### width

    private float width

  the width of the Table.

### widthpercentage

    private float widthpercentage

  the widthpercentage of the Table.

### cellspacing

    private float cellspacing

  the spacing of the Cells.

### cellpadding

    private float cellpadding

  the padding of the Cells.

### alignment

    private int alignment

  the alignment of the table.

Constructor Detail

### SimpleTable

    public SimpleTable()

  A RectangleCell is always constructed without any dimensions. Dimensions are defined after creation.

Method Detail

### addElement

    public void addElement(SimpleCell element)
                    throws BadElementException

  Adds content to this object.

  Parameters:
    `element` -
  Throws:
    `BadElementException`

### createTable

    public Table createTable()
                      throws BadElementException

  Creates a Table object based on this TableAttributes object.

  Returns:
    a com.lowagie.text.Table object
  Throws:
    `BadElementException`

### createPdfPTable

    public PdfPTable createPdfPTable()
                              throws DocumentException

  Creates a PdfPTable object based on this TableAttributes object.

  Returns:
    a com.lowagie.text.pdf.PdfPTable object
  Throws:
    `DocumentException`

### getDimensionlessInstance

    public static SimpleTable getDimensionlessInstance(Rectangle rectangle,
                                                       float spacing)

  Parameters:
    `rectangle` -
    `spacing` -
  Returns:
    a rectangle

### tableLayout

    public void tableLayout(PdfPTable table,
                            float[][] widths,
                            float[] heights,
                            int headerRows,
                            int rowStart,
                            PdfContentByte[] canvases)

  Description copied from interface: `PdfPTableEvent`
  This method is called at the end of the table rendering. The text or graphics are added to one of the 4 `PdfContentByte` contained in `canvases`.
  The indexes to `canvases` are:

  - `PdfPTable.BASECANVAS` - the original `PdfContentByte`. Anything placed here will be under the table.
  - `PdfPTable.BACKGROUNDCANVAS` - the layer where the background goes to.
  - `PdfPTable.LINECANVAS` - the layer where the lines go to.
  - `PdfPTable.TEXTCANVAS` - the layer where the text go to. Anything placed here will be over the table.
  The layers are placed in sequence on top of each other.

  The `widths` and `heights` have the coordinates of the cells.
  The size of the `widths` array is the number of rows. Each sub-array in `widths` corresponds to the x column border positions where the first element is the x coordinate of the left table border and the last element is the x coordinate of the right table border. If colspan is not used all the sub-arrays in `widths` are the same.
  For the `heights` the first element is the y coordinate of the top table border and the last element is the y coordinate of the bottom table border.

  Specified by:
    `tableLayout` in interface `PdfPTableEvent`
  Parameters:
    `table` - the `PdfPTable` in use
    `widths` - an array of arrays with the cells' x positions. It has the length of the number of rows
    `heights` - an array with the cells' y positions. It has a length of the number of rows + 1
    `headerRows` - the number of rows defined for the header.
    `rowStart` - the first row number after the header
    `canvases` - an array of `PdfContentByte`
  See Also:
    `PdfPTableEvent.tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])`

### getCellpadding

    public float getCellpadding()

  Returns:
    Returns the cellpadding.

### setCellpadding

    public void setCellpadding(float cellpadding)

  Parameters:
    `cellpadding` - The cellpadding to set.

### getCellspacing

    public float getCellspacing()

  Returns:
    Returns the cellspacing.

### setCellspacing

    public void setCellspacing(float cellspacing)

  Parameters:
    `cellspacing` - The cellspacing to set.

### getAlignment

    public int getAlignment()

  Returns:
    Returns the alignment.

### setAlignment

    public void setAlignment(int alignment)

  Parameters:
    `alignment` - The alignment to set.

### getWidth

    public float getWidth()

  Returns:
    Returns the width.

### setWidth

    public void setWidth(float width)

  Parameters:
    `width` - The width to set.

### getWidthpercentage

    public float getWidthpercentage()

  Returns:
    Returns the widthpercentage.

### setWidthpercentage

    public void setWidthpercentage(float widthpercentage)

  Parameters:
    `widthpercentage` - The widthpercentage to set.

### 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()`

### add

    public boolean add(java.lang.Object o)

  Description copied from interface: `TextElementArray`
  Adds an object to the `TextElementArray`.

  Specified by:
    `add` in interface `TextElementArray`
  Parameters:
    `o` - an object that has to be added
  Returns:
    `true` if the addition succeeded; `false` otherwise
  See Also:
    `TextElementArray.add(java.lang.Object)`