Home » iText-2.1.7 » com.lowagie » text » [javadoc | source]
com.lowagie.text
public class: Cell [javadoc | source]
java.lang.Object
   com.lowagie.text.Rectangle
      com.lowagie.text.Cell

All Implemented Interfaces:
    TextElementArray, Element

Direct Known Subclasses:
    RtfTableCell, RtfCell

A Cell is a Rectangle containing other Elements.

A Cell must be added to a Table. The Table will place the Cell in a Row.

Example:

Table table = new Table(3);
table.setBorderWidth(1);
table.setBorderColor(new Color(0, 0, 255));
table.setCellpadding(5);
table.setCellspacing(5);
Cell cell = new Cell("header");
cell.setHeader(true);
cell.setColspan(3);
table.addCell(cell);
cell = new Cell("example cell with colspan 1 and rowspan 2");
cell.setRowspan(2);
cell.setBorderColor(new Color(255, 0, 0));
table.addCell(cell);
table.addCell("1.1");
table.addCell("2.1");
table.addCell("1.2");
table.addCell("2.2");
Field Summary
protected  ArrayList arrayList    The ArrayList of Elements that are part of the content of the Cell. 
protected  int horizontalAlignment    The horizontal alignment of the cell content. 
protected  int verticalAlignment    The vertical alignment of the cell content. 
protected  float width    The width of the cell as a String. It can be an absolute value "100" or a percentage "20%". 
protected  boolean percentage     
protected  int colspan    The colspan of the cell. 
protected  int rowspan    The rowspan of the cell. 
 float leading    The leading of the content inside the cell. 
protected  boolean header    Is this Cell a header? 
protected  int maxLines    Maximum number of lines allowed in the cell. The default value of this property is not to limit the maximum number of lines (contributed by dperezcar@fcc.es) 
 String showTruncation    If a truncation happens due to the maxLines property, then this text will be added to indicate a truncation has happened. Default value is null, and means avoiding marking the truncation. A useful value of this property could be e.g. "..." (contributed by dperezcar@fcc.es) 
protected  boolean useAscender    Indicates that the largest ascender height should be used to determine the height of the first line. Note that this only has an effect when rendered to PDF. Setting this to true can help with vertical alignment problems. 
protected  boolean useDescender    Indicates that the largest descender height should be added to the height of the last line (so characters like y don't dip into the border). Note that this only has an effect when rendered to PDF. 
protected  boolean useBorderPadding    Adjusts the cell contents to compensate for border widths. Note that this only has an effect when rendered to PDF. 
protected  boolean groupChange    Does this Cell force a group change? 
Fields inherited from com.lowagie.text.Rectangle:
UNDEFINED,  TOP,  BOTTOM,  LEFT,  RIGHT,  NO_BORDER,  BOX,  llx,  lly,  urx,  ury,  rotation,  backgroundColor,  border,  useVariableBorders,  borderWidth,  borderWidthLeft,  borderWidthRight,  borderWidthTop,  borderWidthBottom,  borderColor,  borderColorLeft,  borderColorRight,  borderColorTop,  borderColorBottom
Constructor:
 public Cell() 
 public Cell(boolean dummy) 
 public Cell(String content) 
    Constructs a Cell with a certain content.

    The String will be converted into a Paragraph.

    Parameters:
    content - a String
 public Cell(Element element) throws BadElementException 
    Constructs a Cell with a certain Element.

    if the element is a ListItem, Row or Cell, an exception will be thrown.

    Parameters:
    element - the element
    Throws:
    BadElementException - when the creator was called with a ListItem, Row or Cell
Method from com.lowagie.text.Cell Summary:
add,   addElement,   bottom,   clear,   createPdfPCell,   fill,   getBottom,   getChunks,   getColspan,   getElements,   getGroupChange,   getHorizontalAlignment,   getLeading,   getLeft,   getMaxLines,   getRight,   getRowspan,   getShowTruncation,   getTop,   getVerticalAlignment,   getWidth,   getWidthAsString,   isEmpty,   isHeader,   isTable,   isUseAscender,   isUseBorderPadding,   isUseDescender,   left,   process,   right,   setBottom,   setColspan,   setGroupChange,   setHeader,   setHorizontalAlignment,   setHorizontalAlignment,   setLeading,   setLeft,   setMaxLines,   setRight,   setRowspan,   setShowTruncation,   setTop,   setUseAscender,   setUseBorderPadding,   setUseDescender,   setVerticalAlignment,   setVerticalAlignment,   setWidth,   setWidth,   size,   top,   type
Methods from 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,   type
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.Cell Detail:
 public boolean add(Object o) 
    Add an Object to this cell.
 public  void addElement(Element element) throws BadElementException 
    Adds an element to this Cell.

    Remark: you can't add ListItems, Rows, Cells, JPEGs, GIFs or PNGs to a Cell.

 public float bottom(int margin) 
    This method throws an UnsupportedOperationException.
 public  void clear() 
    Clears all the Elements of this Cell.
 public PdfPCell createPdfPCell() throws BadElementException 
    Creates a PdfPCell based on this Cell object.
  void fill() 
    Makes sure there is at least 1 object in the Cell. Otherwise it might not be shown in the table.
 public float getBottom() 
    This method throws an UnsupportedOperationException.
 public ArrayList getChunks() 
    Gets all the chunks in this element.
 public int getColspan() 
    Gets the colspan.
 public Iterator getElements() 
    Gets an iterator of Elements.
 public boolean getGroupChange() 
    Does this Cell force a group change?
 public int getHorizontalAlignment() 
    Gets the horizontal alignment.
 public float getLeading() 
    Gets the leading.
 public float getLeft() 
    This method throws an UnsupportedOperationException.
 public int getMaxLines() 
    Getter for maxLines
 public float getRight() 
    This method throws an UnsupportedOperationException.
 public int getRowspan() 
    Gets the rowspan.
 public String getShowTruncation() 
    Getter for showTruncation
 public float getTop() 
    This method throws an UnsupportedOperationException.
 public int getVerticalAlignment() 
    Gets the vertical alignment.
 public float getWidth() 
    Gets the width.
 public String getWidthAsString() 
    Gets the width as a String.
 public boolean isEmpty() 
    Checks if the Cell is empty.
 public boolean isHeader() 
    Is this Cell a header?
 public boolean isTable() 
    Checks if this Cell is a placeholder for a (nested) table.
 public boolean isUseAscender() 
    Gets the value of useAscender
 public boolean isUseBorderPadding() 
    Gets the value of useBorderPadding.
 public boolean isUseDescender() 
    gets the value of useDescender
 public float left(int margin) 
    This method throws an UnsupportedOperationException.
 public boolean process(ElementListener listener) 
    Processes the element by adding it (or the different parts) to an ElementListener.
 public float right(int margin) 
    This method throws an UnsupportedOperationException.
 public  void setBottom(int value) 
    This method throws an UnsupportedOperationException.
 public  void setColspan(int value) 
    Sets the colspan.
 public  void setGroupChange(boolean value) 
    Sets group change.
 public  void setHeader(boolean value) 
    Sets header.
 public  void setHorizontalAlignment(int value) 
    Sets the horizontal alignment.
 public  void setHorizontalAlignment(String alignment) 
    Sets the alignment of this cell. This methods allows you to set the alignment as a String.
 public  void setLeading(float value) 
    Sets the leading.
 public  void setLeft(int value) 
    This method throws an UnsupportedOperationException.
 public  void setMaxLines(int value) 
    Setter for maxLines
 public  void setRight(int value) 
    This method throws an UnsupportedOperationException.
 public  void setRowspan(int value) 
    Sets the rowspan.
 public  void setShowTruncation(String value) 
    Setter for showTruncation
 public  void setTop(int value) 
    This method throws an UnsupportedOperationException.
 public  void setUseAscender(boolean use) 
    Sets the value of useAscender.
 public  void setUseBorderPadding(boolean use) 
    Sets the value of useBorderPadding.
 public  void setUseDescender(boolean use) 
    Sets the value of useDescender.
 public  void setVerticalAlignment(int value) 
    Sets the vertical alignment.
 public  void setVerticalAlignment(String alignment) 
    Sets the alignment of this paragraph.
 public  void setWidth(float value) 
    Sets the width.
 public  void setWidth(String value) 
    Sets the width. It can be an absolute value "100" or a percentage "20%"
 public int size() 
    Gets the number of Elements in the Cell.
 public float top(int margin) 
    This method throws an UnsupportedOperationException.
 public int type() 
    Gets the type of the text element.