com.lowagie.text
public class Cell extends Rectangle implements TextElementArray
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 | colspan The colspan of the cell. |
| protected boolean | groupChange Does this Cell force a group change? |
| protected boolean | header Is this Cell a header? |
| protected int | horizontalAlignment The horizontal alignment of the cell content. |
| float | leading The leading of the content inside the cell. |
| protected int | maxLines
Maximum number of lines allowed in the cell.
|
| protected boolean | percentage |
| protected int | rowspan The rowspan of the cell. |
| String | showTruncation
If a truncation happens due to the maxLines property, then this text will
be added to indicate a truncation has happened.
|
| protected boolean | useAscender
Indicates that the largest ascender height should be used to determine the
height of the first line. |
| protected boolean | useBorderPadding
Adjusts the cell contents to compensate for border widths. |
| 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). |
| protected int | verticalAlignment The vertical alignment of the cell content. |
| protected float | width
The width of the cell as a String.
|
| Constructor Summary | |
|---|---|
| Cell() Constructs an empty Cell. | |
| Cell(boolean dummy)
Constructs an empty Cell (for internal use only).
| |
| Cell(String content)
Constructs a Cell with a certain content.
The | |
| Cell(Element element)
Constructs a Cell with a certain Element.
if the element is a | |
| Method Summary | |
|---|---|
| boolean | add(Object o)
Add an Object to this cell.
|
| void | addElement(Element element)
Adds an element to this Cell.
|
| float | bottom(int margin)
This method throws an UnsupportedOperationException. |
| void | clear()
Clears all the Elements of this Cell. |
| PdfPCell | createPdfPCell()
Creates a PdfPCell based on this Cell object. |
| void | fill()
Makes sure there is at least 1 object in the Cell.
|
| float | getBottom()
This method throws an UnsupportedOperationException. |
| ArrayList | getChunks()
Gets all the chunks in this element.
|
| int | getColspan()
Gets the colspan. |
| static Cell | getDummyCell()
Get dummy cell used when merging inner tables. |
| Iterator | getElements()
Gets an iterator of Elements.
|
| boolean | getGroupChange()
Does this Cell force a group change?
|
| int | getHorizontalAlignment()
Gets the horizontal alignment.
|
| float | getLeading()
Gets the leading.
|
| float | getLeft()
This method throws an UnsupportedOperationException. |
| int | getMaxLines()
Getter for maxLines |
| float | getRight()
This method throws an UnsupportedOperationException. |
| int | getRowspan()
Gets the rowspan. |
| String | getShowTruncation()
Getter for showTruncation |
| float | getTop()
This method throws an UnsupportedOperationException. |
| int | getVerticalAlignment()
Gets the vertical alignment. |
| float | getWidth()
Gets the width. |
| String | getWidthAsString()
Gets the width as a String.
|
| boolean | isEmpty()
Checks if the Cell is empty.
|
| boolean | isHeader()
Is this Cell a header?
|
| boolean | isTable()
Checks if this Cell is a placeholder for a (nested) table.
|
| boolean | isUseAscender()
Gets the value of useAscender |
| boolean | isUseBorderPadding()
Gets the value of useBorderPadding. |
| boolean | isUseDescender()
gets the value of useDescender |
| float | left(int margin)
This method throws an UnsupportedOperationException. |
| boolean | process(ElementListener listener)
Processes the element by adding it (or the different parts) to an
ElementListener.
|
| float | right(int margin)
This method throws an UnsupportedOperationException. |
| void | setBottom(int value)
This method throws an UnsupportedOperationException. |
| void | setColspan(int value)
Sets the colspan.
|
| void | setGroupChange(boolean value)
Sets group change.
|
| void | setHeader(boolean value)
Sets header.
|
| void | setHorizontalAlignment(int value)
Sets the horizontal alignment. |
| void | setHorizontalAlignment(String alignment)
Sets the alignment of this cell.
|
| void | setLeading(float value)
Sets the leading.
|
| void | setLeft(int value)
This method throws an UnsupportedOperationException. |
| void | setMaxLines(int value)
Setter for maxLines |
| void | setRight(int value)
This method throws an UnsupportedOperationException. |
| void | setRowspan(int value)
Sets the rowspan.
|
| void | setShowTruncation(String value)
Setter for showTruncation |
| void | setTop(int value)
This method throws an UnsupportedOperationException. |
| void | setUseAscender(boolean use)
Sets the value of useAscender. |
| void | setUseBorderPadding(boolean use)
Sets the value of useBorderPadding. |
| void | setUseDescender(boolean use)
Sets the value of useDescender. |
| void | setVerticalAlignment(int value)
Sets the vertical alignment. |
| void | setVerticalAlignment(String alignment)
Sets the alignment of this paragraph.
|
| void | setWidth(float value)
Sets the width.
|
| void | setWidth(String value)
Sets the width.
|
| int | size()
Gets the number of Elements in the Cell.
|
| float | top(int margin)
This method throws an UnsupportedOperationException. |
| int | type()
Gets the type of the text element.
|
ArrayList of Elements
that are part of the content of the Cell.Cell force a group change?Cell a header?Cell.Cell (for internal use only).
Parameters: dummy a dummy value
Cell with a certain content.
The String will be converted into a Paragraph.
Parameters: content a String
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
Object to this cell.
Parameters: o the object to add
Returns: always true
Cell.
Remark: you can't add ListItems, Rows, Cells,
JPEGs, GIFs or PNGs to a Cell.
Parameters: element The Element to add
Throws: BadElementException if the method was called with a ListItem, Row or Cell
UnsupportedOperationException.Parameters: margin
Returns: NA
Elements of this Cell.Returns: a PdfPCell
Throws: BadElementException
UnsupportedOperationException.Returns: NA
Returns: an ArrayList
Returns: a value
Returns: a cell with colspan 3 and no border
Elements.
Returns: an Iterator.
Cell force a group change?
Returns: a value
Returns: a value
Returns: a value
UnsupportedOperationException.Returns: NA
Returns: the maxLines value
UnsupportedOperationException.Returns: NA
Returns: a value
Returns: the showTruncation value
UnsupportedOperationException.Returns: NA
Returns: a value
Returns: a value
Cell is empty.
Returns: false if there are non-empty Elements in the Cell.
Cell a header?
Returns: a value
Cell is a placeholder for a (nested) table.
Returns: true if the only element in this cell is a table
Returns: useAscender
Returns: useBorderPadding
Returns: useDescender
UnsupportedOperationException.Parameters: margin
Returns: NA
ElementListener.
Parameters: listener an ElementListener
Returns: true if the element was processed successfully
UnsupportedOperationException.Parameters: margin NA
Returns: NA
UnsupportedOperationException.Parameters: value NA
Parameters: value the new value
Parameters: value the new value
Parameters: value the new value
Parameters: value the new value
Parameters: alignment the new alignment as a String
Parameters: value the new value
UnsupportedOperationException.Parameters: value NA
Parameters: value the maximum number of lines
UnsupportedOperationException.Parameters: value NA
Parameters: value the new value
Parameters: value Can be null for avoiding marking the truncation.
UnsupportedOperationException.Parameters: value NA
Parameters: use use ascender height if true
Parameters: use adjust layout for borders if true
Parameters: use use descender height if true
Parameters: value the new value
Parameters: alignment the new alignment as a String
Parameters: value the new value
Parameters: value the new value
Elements in the Cell.
Returns: a size.
UnsupportedOperationException.Parameters: margin
Returns: NA
Returns: a type