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
FieldsFields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, stylesFields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties -
Constructor Summary
Constructors -
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.intgetCol()Getsthe number of the columnin which the cell is located.intGets thecolspanof the cell.T1 getDefaultProperty(int property) Gets the default property from this entity.Gets a cell renderer for this element.intgetRow()Getsthe number of the rowin which the cell is located.intGets therowspanof the cell.protected IRendererCreates a new renderer instance.toString()protected CellupdateCellIndexes(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, setWidthMethods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumberMethods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, getTransparentStrokeColor, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalicMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.itextpdf.layout.element.IAbstractElement
getChildrenMethods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, setNextRendererMethods 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:
-
getRendererin interfaceIElement - Overrides:
-
getRendererin classAbstractElement<Cell> - Returns:
- a cell renderer for this element
-
getRow
public int getRow()Getsthe number of the rowin which the cell is located.- Returns:
- the row number
-
getCol
public int getCol()Getsthe number of the columnin which the cell is located.- Returns:
- the column number
-
getRowspan
public int getRowspan()Gets therowspanof the cell.- Returns:
- the rowspan
-
getColspan
public int getColspan()Gets thecolspanof 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:IPropertyContainerGets the default property from this entity.- Specified by:
-
getDefaultPropertyin interfaceIPropertyContainer - Overrides:
-
getDefaultPropertyin 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,
nullwill be returned
-
toString
-
getAccessibilityProperties
Description copied from interface:IAccessibleElementGets theaccessibility properties. See alsoIAccessibleElement.- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
Description copied from class:AbstractElementCreates a new renderer instance.- Specified by:
-
makeNewRendererin 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
Cellwith updated fields
-