com.lowagie.text
public class Cell extends Rectangle implements TextElementArray
Cell
is a Rectangle
containing other
Element
s.
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 Element s
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 | |
Cell(Properties attributes)
Returns a Cell that has been constructed taking in account
the value of some attributes.
|
Method Summary | |
---|---|
boolean | add(Object o)
Add an Object to this cell.
|
void | addElement(Element element)
Adds an element to this Cell .
|
float | bottom()
This method throws an UnsupportedOperationException . |
float | bottom(int margin)
This method throws an UnsupportedOperationException . |
String | cellWidth()
Gets the width.
|
void | clear()
Clears all the Element s of this Cell . |
int | colspan()
Gets the colspan. |
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 Element s.
|
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 |
float | getRight()
This method throws an UnsupportedOperationException . |
int | getRowspan()
Gets the rowspan. |
String | getShowTruncation()
Getter for |
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 | header()
Is this Cell a header?
|
int | horizontalAlignment()
Gets the horizontal alignment. |
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 |
boolean | isUseBorderPadding()
Gets the value of useBorderPadding. |
boolean | isUseDescender()
gets the value of |
float | leading()
Gets the leading.
|
float | left()
This method throws an UnsupportedOperationException . |
float | left(int margin)
This method throws an UnsupportedOperationException . |
boolean | noWrap()
Get nowrap.
|
boolean | process(ElementListener listener)
Processes the element by adding it (or the different parts) to an
ElementListener .
|
float | right()
This method throws an UnsupportedOperationException . |
float | right(int margin)
This method throws an UnsupportedOperationException . |
int | rowspan()
Gets the rowspan. |
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 |
void | setNoWrap(boolean value)
Set nowrap.
|
void | setRight(int value)
This method throws an UnsupportedOperationException . |
void | setRowspan(int value)
Sets the rowspan.
|
void | setShowTruncation(String value)
Setter for |
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 Element s in the Cell.
|
float | top()
This method throws an UnsupportedOperationException . |
float | top(int margin)
This method throws an UnsupportedOperationException . |
int | type()
Gets the type of the text element.
|
int | verticalAlignment()
Gets the vertical alignment. |
ArrayList
of Element
s
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
Deprecated: use ElementFactory.getCell(attributes)
Returns aCell
that has been constructed taking in account
the value of some attributes.
Parameters: attributes Some attributes
Object
to this cell.
Parameters: o the object to add
Returns: always true
Cell
.
Remark: you can't add ListItem
s, Row
s, Cell
s,
JPEG
s, GIF
s or PNG
s 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
Deprecated: Use getWidthAsString instead
Gets the width.Returns: a value
Element
s of this Cell
.Deprecated: Use getColspan instead
Gets the colspan.Returns: a value
Returns: a PdfPCell
Throws: BadElementException
UnsupportedOperationException
.Returns: NA
Returns: an ArrayList
Returns: a value
Returns: a cell with colspan 3 and no border
Element
s.
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
Deprecated: Use getHorizontalAlignment instead
Gets the horizontal alignment.Returns: a value
Cell
is empty.
Returns: false
if there are non-empty Element
s 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
Deprecated: Use getLeading instead
Gets the leading.Returns: a value
UnsupportedOperationException
.Parameters: margin
Returns: NA
Deprecated: Use getMaxLines() == 1 instead
Get nowrap.Returns: a value
ElementListener
.
Parameters: listener an ElementListener
Returns: true
if the element was processed successfully
UnsupportedOperationException
.Parameters: margin NA
Returns: NA
Deprecated: Use getRowspan instead
Gets the rowspan.Returns: a value
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
Deprecated: Use setMaxLines(1) instead
Set nowrap.Parameters: value the new value
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 layour 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
Element
s in the Cell.
Returns: a size
.
UnsupportedOperationException
.Parameters: margin
Returns: NA
Returns: a type
Deprecated: Use getVerticalAlignment instead
Gets the vertical alignment.Returns: a value