## com.lowagie.text.rtf.table
Class RtfCell

    java.lang.Object
      com.lowagie.text.Rectangle
          com.lowagie.text.Cell
              com.lowagie.text.rtf.table.RtfCell

All Implemented Interfaces:
  Element, MarkupAttributes, RtfBasicElement, RtfExtendedElement, TextElementArray

    public class RtfCell

extends Cell
implements RtfExtendedElement

The RtfCell wraps a Cell, but can also be added directly to a Table. The RtfCell is an extension of Cell, that supports a multitude of different borderstyles.

Version:
  $Id: RtfCell.java,v 1.17 2006/09/12 13:12:55 blowagie Exp $
Author:
  Mark Hall (mhall@edu.uni-klu.ac.at), Steffen Stundzig, Benoit Wiart
See Also:
  `RtfBorder`

Field Summary
`private RtfColor` `backgroundColor` The background color of this RtfCell
`private RtfBorderGroup` `borders` The borders of this RtfCell
`private int` `cellPadding` The padding of this RtfCell
`private int` `cellRight` The right margin of this RtfCell
`private int` `cellWidth` The width of this RtfCell
`private int` `colspan` The number of columns spanned by this RtfCell
`private java.util.ArrayList` `content` The content of this RtfCell
`private boolean` `deleted` Whether this RtfCell is a placeholder for a removed table cell.
`private RtfDocument` `document` The RtfDocument this RtfCell belongs to
`private boolean` `inHeader` Whether this RtfCell is in a header
`private static int` `MERGE_NONE` This cell is not merged
`private static int` `MERGE_VERT_CHILD` This cell is a child cell of a vertical merge operation
`private static int` `MERGE_VERT_PARENT` This cell is the parent cell of a vertical merge operation
`private int` `mergeType` The merge type of this RtfCell
`private RtfRow` `parentRow` The parent RtfRow of this RtfCell
`private int` `rowspan` The number of rows spanned by this RtfCell
`private int` `verticalAlignment` The vertical alignment of this RtfCell

Fields inherited from class com.lowagie.text.Cell
`arrayList, groupChange, header, horizontalAlignment, maxLines, useAscender, useBorderPadding, useDescender, width`

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`

Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
`CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR`

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, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE`

Constructor Summary
`` `RtfCell()` Constructs an empty RtfCell
`protected` `RtfCell(boolean deleted)` Constructs a deleted RtfCell.
`` `RtfCell(Element element)` Constructs a RtfCell based upon an Element
`` `RtfCell(java.util.Properties properties)` Constructs a RtfCell based upon certain Properties
`protected` `RtfCell(RtfDocument doc, RtfRow row, Cell cell)` Constructs a RtfCell based on a Cell.
`` `RtfCell(java.lang.String content)` Constructs a RtfCell based upon a String

Method Summary
`protected RtfColor` `getBackgroundColor()` Get the background color of this RtfCell
`protected RtfBorderGroup` `getBorders()` Gets the borders of this RtfCell
`protected int` `getCellpadding()` Gets the cell padding of this RtfCell
`protected int` `getCellRight()` Gets the right margin of this RtfCell
`protected int` `getCellWidth()` Gets the cell width of this RtfCell
`protected int` `getColspan()` Gets the number of columns this RtfCell spans
`protected int` `getRowspan()` Gets the number of rows this RtfCell spans
`protected int` `getVerticalAlignment()` Get the vertical alignment of this RtfCell
`private void` `importCell(Cell cell)` Imports the Cell properties into the RtfCell
`private byte[]` `intToByteArray(int i)` Transforms an integer into its String representation and then returns the bytes of that string.
`boolean` `isDeleted()` Checks whether this RtfCell is a placeholder for a table cell that has been removed due to col/row spanning.
`void` `setBorders(RtfBorderGroup borderGroup)` Set the borders of this RtfCell
`protected void` `setCellMergeChild(RtfCell mergeParent)` Merge this cell into the parent cell.
`protected void` `setCellRight(int cellRight)` Sets the right margin of this cell.
`protected void` `setCellWidth(int cellWidth)` Sets the cell width of this RtfCell.
`void` `setInHeader(boolean inHeader)` Sets whether this RtfCell is in a header
`void` `setInTable(boolean inTable)` Unused
`void` `setRtfDocument(RtfDocument doc)` Sets the RtfDocument this RtfCell belongs to
`byte[]` `write()` Write the content of this RtfCell
`byte[]` `writeDefinition()` Write the cell definition part of this RtfCell

Methods inherited from class com.lowagie.text.Cell

`add, addElement, bottom, bottom, cellWidth, clear, colspan, createPdfPCell, getChunks, getDummyCell, getElements, getGroupChange, getMaxLines, getShowTruncation, header, horizontalAlignment, isEmpty, isTable, isTag, isUseAscender, isUseBorderPadding, isUseDescender, leading, left, left, noWrap, process, right, right, rowspan, setBottom, setColspan, setGroupChange, setHeader, setHorizontalAlignment, setHorizontalAlignment, setLeading, setLeft, setMaxLines, setNoWrap, setRight, setRowspan, setShowTruncation, setTop, setUseAscender, setUseBorderPadding, setUseDescender, setVerticalAlignment, setVerticalAlignment, setWidth, size, top, top, type, verticalAlignment`

Methods inherited from class com.lowagie.text.Rectangle

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

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

Methods inherited from interface com.lowagie.text.Element
`toString`

Field Detail

### MERGE_NONE

    private static final int MERGE_NONE

  This cell is not merged

  See Also:
    Constant Field Values

### MERGE_VERT_PARENT

    private static final int MERGE_VERT_PARENT

  This cell is the parent cell of a vertical merge operation

  See Also:
    Constant Field Values

### MERGE_VERT_CHILD

    private static final int MERGE_VERT_CHILD

  This cell is a child cell of a vertical merge operation

  See Also:
    Constant Field Values

### parentRow

    private RtfRow parentRow

  The parent RtfRow of this RtfCell

### content

    private java.util.ArrayList content

  The content of this RtfCell

### cellRight

    private int cellRight

  The right margin of this RtfCell

### cellWidth

    private int cellWidth

  The width of this RtfCell

### borders

    private RtfBorderGroup borders

  The borders of this RtfCell

### verticalAlignment

    private int verticalAlignment

  The vertical alignment of this RtfCell

### backgroundColor

    private RtfColor backgroundColor

  The background color of this RtfCell

### cellPadding

    private int cellPadding

  The padding of this RtfCell

### mergeType

    private int mergeType

  The merge type of this RtfCell

### colspan

    private int colspan

  The number of columns spanned by this RtfCell

### rowspan

    private int rowspan

  The number of rows spanned by this RtfCell

### document

    private RtfDocument document

  The RtfDocument this RtfCell belongs to

### inHeader

    private boolean inHeader

  Whether this RtfCell is in a header

### deleted

    private boolean deleted

  Whether this RtfCell is a placeholder for a removed table cell.

Constructor Detail

### RtfCell

    public RtfCell()

  Constructs an empty RtfCell

### RtfCell

    public RtfCell(java.lang.String content)

  Constructs a RtfCell based upon a String

  Parameters:
    `content` - The String to base the RtfCell on

### RtfCell

    public RtfCell(Element element)
            throws BadElementException

  Constructs a RtfCell based upon an Element

  Parameters:
    `element` - The Element to base the RtfCell on
  Throws:
    `BadElementException` - If the Element is not valid

### RtfCell

    public RtfCell(java.util.Properties properties)

  Constructs a RtfCell based upon certain Properties

  Parameters:
    `properties` - The Properties for this RtfCell

### RtfCell

    protected RtfCell(boolean deleted)

  Constructs a deleted RtfCell.

  Parameters:
    `deleted` - Whether this RtfCell is actually deleted.

### RtfCell

    protected RtfCell(RtfDocument doc,
                      RtfRow row,
                      Cell cell)

  Constructs a RtfCell based on a Cell.

  Parameters:
    `doc` - The RtfDocument this RtfCell belongs to
    `row` - The RtfRow this RtfCell lies in
    `cell` - The Cell to base this RtfCell on

Method Detail

### importCell

    private void importCell(Cell cell)

  Imports the Cell properties into the RtfCell

  Parameters:
    `cell` - The Cell to import

### writeDefinition

    public byte[] writeDefinition()

  Write the cell definition part of this RtfCell

  Specified by:
    `writeDefinition` in interface `RtfExtendedElement`
  Returns:
    A byte array with the cell definition

### write

    public byte[] write()

  Write the content of this RtfCell

  Specified by:
    `write` in interface `RtfBasicElement`
  Returns:
    A byte array with the content of this RtfCell

### setCellRight

    protected void setCellRight(int cellRight)

  Sets the right margin of this cell. Used in merge operations

  Parameters:
    `cellRight` - The right margin to use

### getCellRight

    protected int getCellRight()

  Gets the right margin of this RtfCell

  Returns:
    The right margin of this RtfCell.

### setCellWidth

    protected void setCellWidth(int cellWidth)

  Sets the cell width of this RtfCell. Used in merge operations.

  Parameters:
    `cellWidth` - The cell width to use

### getCellWidth

    protected int getCellWidth()

  Gets the cell width of this RtfCell

  Returns:
    The cell width of this RtfCell

### getColspan

    protected int getColspan()

  Gets the number of columns this RtfCell spans

  Returns:
    The number of columns this RtfCell spans

### getRowspan

    protected int getRowspan()

  Gets the number of rows this RtfCell spans

  Returns:
    The number of rows this RtfCell spans

### getCellpadding

    protected int getCellpadding()

  Gets the cell padding of this RtfCell

  Returns:
    The cell padding of this RtfCell

### getBorders

    protected RtfBorderGroup getBorders()

  Gets the borders of this RtfCell

  Returns:
    The borders of this RtfCell

### setBorders

    public void setBorders(RtfBorderGroup borderGroup)

  Set the borders of this RtfCell

  Parameters:
    `borderGroup` - The RtfBorderGroup to use as borders

### getVerticalAlignment

    protected int getVerticalAlignment()

  Get the vertical alignment of this RtfCell

  Returns:
    The vertical alignment of this RtfCell

### getBackgroundColor

    protected RtfColor getBackgroundColor()

  Get the background color of this RtfCell

  Returns:
    The background color of this RtfCell

### setCellMergeChild

    protected void setCellMergeChild(RtfCell mergeParent)

  Merge this cell into the parent cell.

  Parameters:
    `mergeParent` - The RtfCell to merge with

### setRtfDocument

    public void setRtfDocument(RtfDocument doc)

  Sets the RtfDocument this RtfCell belongs to

  Specified by:
    `setRtfDocument` in interface `RtfBasicElement`
  Parameters:
    `doc` - The RtfDocument to use

### setInTable

    public void setInTable(boolean inTable)

  Unused

  Specified by:
    `setInTable` in interface `RtfBasicElement`
  Parameters:
    `inTable` -

### setInHeader

    public void setInHeader(boolean inHeader)

  Sets whether this RtfCell is in a header

  Specified by:
    `setInHeader` in interface `RtfBasicElement`
  Parameters:
    `inHeader` - `True` if this RtfCell is in a header, `false` otherwise

### intToByteArray

    private byte[] intToByteArray(int i)

  Transforms an integer into its String representation and then returns the bytes of that string.

  Parameters:
    `i` - The integer to convert
  Returns:
    A byte array representing the integer

### isDeleted

    public boolean isDeleted()

  Checks whether this RtfCell is a placeholder for a table cell that has been removed due to col/row spanning.

  Returns:
    `True` if this RtfCell is deleted, `false` otherwise.