Package com.itextpdf.layout.element
Class Cell
- All Implemented Interfaces:
-
IAbstractElement
,IBlockElement
,IElement
,IPropertyContainer
,IAccessibleElement
A
Cell
is one piece of data in an enclosing grid, the Table
. This object is a BlockElement
, giving it a number of visual layout properties. A cell can act as a container for a number of layout elements; it can only contain other BlockElement
objects or images. Other types of layout elements must be wrapped in a BlockElement
.
-
Field Summary
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(IBlockElement element) Adds any block element to the cell's contents.Adds an image to the cell's contents.clone
(boolean includeContent) Clones a cell with its position, properties, and optionally its contents.Gets theaccessibility properties
.int
getCol()
Getsthe number of the column
in which the cell is located.int
Gets thecolspan
of the cell.T1 getDefaultProperty
(int property) Gets the default property from this entity.Gets a cell renderer for this element.int
getRow()
Getsthe number of the row
in which the cell is located.int
Gets therowspan
of the cell.protected IRenderer
Creates new renderer instance.toString()
protected Cell
updateCellIndexes
(int row, int col, int numberOfColumns) Updates cell indexes.Methods inherited from class com.itextpdf.layout.element.BlockElement
getHeight, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getWidth, isKeepTogether, isKeepWithNext, setHeight, setHeight, setKeepTogether, setKeepWithNext, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMargins, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setNeutralRole, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddings, setPaddingTop, setRotationAngle, setRotationAngle, setSpacingRatio, setVerticalAlignment, setWidth, setWidth
Methods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBold, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setItalic, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.itextpdf.layout.element.IAbstractElement
getChildren
Methods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, setNextRenderer
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
Field Details
-
tagProperties
-
-
Constructor Details
-
Cell
public Cell(int rowspan, int colspan) Creates a cell which takes a custom amount of cell spaces in the table.- Parameters:
-
rowspan
- the number of rows this cell must occupy. Negative numbers will make the argument default to 1. -
colspan
- the number of columns this cell must occupy. Negative numbers will make the argument default to 1.
-
Cell
public Cell()Creates a cell.
-
-
Method Details
-
getRenderer
Gets a cell renderer for this element. Note that this method can be called more than once. By default each element should define its own renderer, but the renderer can be overridden byAbstractElement.setNextRenderer(IRenderer)
method call.- Specified by:
-
getRenderer
in interfaceIElement
- Overrides:
-
getRenderer
in classAbstractElement<Cell>
- Returns:
- a cell renderer for this element
-
getRow
public int getRow()Getsthe number of the row
in which the cell is located.- Returns:
- the row number
-
getCol
public int getCol()Getsthe number of the column
in which the cell is located.- Returns:
- the column number
-
getRowspan
public int getRowspan()Gets therowspan
of the cell.- Returns:
- the rowspan
-
getColspan
public int getColspan()Gets thecolspan
of the cell.- Returns:
- the colspan
-
add
Adds any block element to the cell's contents.- Parameters:
-
element
- aBlockElement
- Returns:
- this Element
-
add
Adds an image to the cell's contents.- Parameters:
-
element
- anImage
- Returns:
- this Element
-
clone
Clones a cell with its position, properties, and optionally its contents.- Parameters:
-
includeContent
- whether or not to also include the contents of the cell. - Returns:
- a clone of this Element
-
getDefaultProperty
publicT1 getDefaultProperty (int property) Description copied from interface:IPropertyContainer
Gets the default property from this entity.- Specified by:
-
getDefaultProperty
in interfaceIPropertyContainer
- Overrides:
-
getDefaultProperty
in classBlockElement<Cell>
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the default property value. If the default property is not defined,
null
will be returned
-
toString
-
getAccessibilityProperties
Description copied from interface:IAccessibleElement
Gets theaccessibility properties
. See alsoIAccessibleElement
.- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
Description copied from class:AbstractElement
Creates new renderer instance.- Specified by:
-
makeNewRenderer
in classAbstractElement<Cell>
- Returns:
-
new
IRenderer
-
updateCellIndexes
Updates cell indexes.- Parameters:
-
row
- the number of the row to update -
col
- the number of the col to update -
numberOfColumns
- to evaluate new colspan - Returns:
-
this
Cell
with updated fields
-