com.lowagie.text.pdf

Class PdfPCell

public class PdfPCell extends Rectangle

A cell in a PdfPTable.
Field Summary
PdfPCellEventcellEvent
Holds value of property cellEvent.
intcolspan
Holds value of property colspan.
ColumnTextcolumn
floatfixedHeight
Fixed height of the cell.
Imageimage
Holds value of property image.
floatminimumHeight
Minimum height of the cell.
booleannoWrap
Holds value of property noWrap.
floatpaddingBottom
Bottom padding of the cell.
floatpaddingLeft
Left padding of the cell.
floatpaddingRight
Right padding of the cell.
floatpaddingTop
Top padding of the cell.
protected Phrasephrase
The text in the cell.
introtation
The rotation of the cell.
introwspan
Holds value of property rowspan.
PdfPTabletable
Holds value of property table.
booleanuseBorderPadding
Increases padding to include border if true
booleanuseDescender
Holds value of property useDescender.
intverticalAlignment
Vertical alignment of the cell.
Constructor Summary
PdfPCell()
Constructs an empty PdfPCell.
PdfPCell(Phrase phrase)
Constructs a PdfPCell with a Phrase.
PdfPCell(Image image)
Constructs a PdfPCell with an Image.
PdfPCell(Image image, boolean fit)
Constructs a PdfPCell with an Image.
PdfPCell(PdfPTable table)
Constructs a PdfPCell with a PdfPtable.
PdfPCell(PdfPTable table, PdfPCell style)
Constructs a PdfPCell with a PdfPtable.
PdfPCell(PdfPCell cell)
Constructs a deep copy of a PdfPCell.
Method Summary
voidaddElement(Element element)
Adds an iText element to the cell.
voidconsumeHeight(float height)
Consumes part of the content of the cell.
intgetArabicOptions()
Gets the arabic shaping options.
PdfPCellEventgetCellEvent()
Gets the cell event for this cell.
intgetColspan()
Getter for property colspan.
ColumnTextgetColumn()
Gets the ColumnText with the content of the cell.
ListgetCompositeElements()
Returns the list of composite elements of the column.
floatgetEffectivePaddingBottom()
Gets the effective bottom padding.
floatgetEffectivePaddingLeft()
Gets the effective left padding.
floatgetEffectivePaddingRight()
Gets the effective right padding.
floatgetEffectivePaddingTop()
Gets the effective top padding.
floatgetExtraParagraphSpace()
Gets the extra space between paragraphs.
floatgetFixedHeight()
Get the fixed height of the cell.
floatgetFollowingIndent()
Gets the following paragraph lines indent.
intgetHorizontalAlignment()
Gets the horizontal alignment for the cell.
ImagegetImage()
Getter for property image.
floatgetIndent()
Gets the first paragraph line indent.
floatgetLeading()
Gets the fixed leading.
floatgetMaxHeight()
Returns the height of the cell.
floatgetMinimumHeight()
Get the minimum height of the cell.
floatgetMultipliedLeading()
Gets the variable leading.
floatgetPaddingBottom()
Getter for property paddingBottom.
floatgetPaddingLeft()
floatgetPaddingRight()
Getter for property paddingRight.
floatgetPaddingTop()
Getter for property paddingTop.
PhrasegetPhrase()
Gets the Phrase from this cell.
floatgetRightIndent()
Gets the right paragraph lines indent.
intgetRotation()
Gets the rotation of the cell.
intgetRowspan()
Getter for property rowspan.
intgetRunDirection()
Gets the run direction of the text content in the cell
floatgetSpaceCharRatio()
Gets the space/character extra spacing ratio for fully justified text.
PdfPTablegetTable()
Getter for property table.
intgetVerticalAlignment()
Gets the vertical alignment for the cell.
booleanhasFixedHeight()
Tells you whether the cell has a fixed height.
booleanhasMinimumHeight()
Tells you whether the cell has a minimum height.
booleanisNoWrap()
Getter for property noWrap.
booleanisUseAscender()
Gets state of first line height based on max ascender
booleanisUseBorderPadding()
If true, then effective padding will include border widths
booleanisUseDescender()
Getter for property useDescender.
voidsetArabicOptions(int arabicOptions)
Sets the arabic shaping options.
voidsetCellEvent(PdfPCellEvent cellEvent)
Sets the cell event for this cell.
voidsetColspan(int colspan)
Setter for property colspan.
voidsetColumn(ColumnText column)
Sets the columntext in the cell.
voidsetExtraParagraphSpace(float extraParagraphSpace)
Sets the extra space between paragraphs.
voidsetFixedHeight(float fixedHeight)
Set a fixed height for the cell.
voidsetFollowingIndent(float indent)
Sets the following paragraph lines indent.
voidsetHorizontalAlignment(int horizontalAlignment)
Sets the horizontal alignment for the cell.
voidsetImage(Image image)
Setter for property image.
voidsetIndent(float indent)
Sets the first paragraph line indent.
voidsetLeading(float fixedLeading, float multipliedLeading)
Sets the leading fixed and variable.
voidsetMinimumHeight(float minimumHeight)
Set a minimum height for the cell.
voidsetNoWrap(boolean noWrap)
Setter for property noWrap.
voidsetPadding(float padding)
Sets the padding of the contents in the cell (space between content and border).
voidsetPaddingBottom(float paddingBottom)
Setter for property paddingBottom.
voidsetPaddingLeft(float paddingLeft)
Setter for property paddingLeft.
voidsetPaddingRight(float paddingRight)
Setter for property paddingRight.
voidsetPaddingTop(float paddingTop)
Setter for property paddingTop.
voidsetPhrase(Phrase phrase)
Sets the Phrase for this cell.
voidsetRightIndent(float indent)
Sets the right paragraph lines indent.
voidsetRotation(int rotation)
Sets the rotation of the cell.
voidsetRowspan(int rowspan)
Setter for property rowspan.
voidsetRunDirection(int runDirection)
Sets the run direction of the text content in the cell.
voidsetSpaceCharRatio(float spaceCharRatio)
Sets the ratio between the extra word spacing and the extra character spacing when the text is fully justified.
voidsetTable(PdfPTable table)
voidsetUseAscender(boolean useAscender)
Enables/ Disables adjustment of first line height based on max ascender.
voidsetUseBorderPadding(boolean use)
Adjusts effective padding to include border widths.
voidsetUseDescender(boolean useDescender)
Setter for property useDescender.
voidsetVerticalAlignment(int verticalAlignment)
Sets the vertical alignment for the cell.

Field Detail

cellEvent

private PdfPCellEvent cellEvent
Holds value of property cellEvent.

colspan

private int colspan
Holds value of property colspan.

column

private ColumnText column

fixedHeight

private float fixedHeight
Fixed height of the cell.

image

private Image image
Holds value of property image.

minimumHeight

private float minimumHeight
Minimum height of the cell.

noWrap

private boolean noWrap
Holds value of property noWrap.

paddingBottom

private float paddingBottom
Bottom padding of the cell.

paddingLeft

private float paddingLeft
Left padding of the cell.

paddingRight

private float paddingRight
Right padding of the cell.

paddingTop

private float paddingTop
Top padding of the cell.

phrase

protected Phrase phrase
The text in the cell.

rotation

private int rotation
The rotation of the cell. Possible values are 0, 90, 180 and 270.

rowspan

private int rowspan
Holds value of property rowspan.

Since: 2.1.6

table

private PdfPTable table
Holds value of property table.

useBorderPadding

private boolean useBorderPadding
Increases padding to include border if true

useDescender

private boolean useDescender
Holds value of property useDescender.

verticalAlignment

private int verticalAlignment
Vertical alignment of the cell.

Constructor Detail

PdfPCell

public PdfPCell()
Constructs an empty PdfPCell. The default padding is 2.

PdfPCell

public PdfPCell(Phrase phrase)
Constructs a PdfPCell with a Phrase. The default padding is 2.

Parameters: phrase the text

PdfPCell

public PdfPCell(Image image)
Constructs a PdfPCell with an Image. The default padding is 0.

Parameters: image the Image

PdfPCell

public PdfPCell(Image image, boolean fit)
Constructs a PdfPCell with an Image. The default padding is 0.25 for a border width of 0.5.

Parameters: image the Image fit true to fit the image to the cell

PdfPCell

public PdfPCell(PdfPTable table)
Constructs a PdfPCell with a PdfPtable. This constructor allows nested tables. The default padding is 0.

Parameters: table The PdfPTable

PdfPCell

public PdfPCell(PdfPTable table, PdfPCell style)
Constructs a PdfPCell with a PdfPtable. This constructor allows nested tables.

Parameters: table The PdfPTable style The style to apply to the cell (you could use getDefaultCell())

Since: 2.1.0

PdfPCell

public PdfPCell(PdfPCell cell)
Constructs a deep copy of a PdfPCell.

Parameters: cell the PdfPCell to duplicate

Method Detail

addElement

public void addElement(Element element)
Adds an iText element to the cell.

Parameters: element

consumeHeight

void consumeHeight(float height)
Consumes part of the content of the cell.

Parameters: height the hight of the part that has to be consumed

Since: 2.1.6

getArabicOptions

public int getArabicOptions()
Gets the arabic shaping options.

Returns: the arabic shaping options

getCellEvent

public PdfPCellEvent getCellEvent()
Gets the cell event for this cell.

Returns: the cell event

getColspan

public int getColspan()
Getter for property colspan.

Returns: Value of property colspan.

getColumn

public ColumnText getColumn()
Gets the ColumnText with the content of the cell.

Returns: a columntext object

getCompositeElements

public List getCompositeElements()
Returns the list of composite elements of the column.

Returns: a List object.

Since: 2.1.1

getEffectivePaddingBottom

public float getEffectivePaddingBottom()
Gets the effective bottom padding. This will include the bottom border width if isUseBorderPadding is true.

Returns: effective value of property paddingBottom.

getEffectivePaddingLeft

public float getEffectivePaddingLeft()
Gets the effective left padding. This will include the left border width if isUseBorderPadding is true.

Returns: effective value of property paddingLeft.

getEffectivePaddingRight

public float getEffectivePaddingRight()
Gets the effective right padding. This will include the right border width if isUseBorderPadding is true.

Returns: effective value of property paddingRight.

getEffectivePaddingTop

public float getEffectivePaddingTop()
Gets the effective top padding. This will include the top border width if isUseBorderPadding is true.

Returns: effective value of property paddingTop.

getExtraParagraphSpace

public float getExtraParagraphSpace()
Gets the extra space between paragraphs.

Returns: the extra space between paragraphs

getFixedHeight

public float getFixedHeight()
Get the fixed height of the cell.

Returns: Value of property fixedHeight.

getFollowingIndent

public float getFollowingIndent()
Gets the following paragraph lines indent.

Returns: the indent

getHorizontalAlignment

public int getHorizontalAlignment()
Gets the horizontal alignment for the cell.

Returns: the horizontal alignment for the cell

getImage

public Image getImage()
Getter for property image.

Returns: Value of property image.

getIndent

public float getIndent()
Gets the first paragraph line indent.

Returns: the indent

getLeading

public float getLeading()
Gets the fixed leading.

Returns: the leading

getMaxHeight

public float getMaxHeight()
Returns the height of the cell.

Returns: the height of the cell

Since: 3.0.0

getMinimumHeight

public float getMinimumHeight()
Get the minimum height of the cell.

Returns: Value of property minimumHeight.

getMultipliedLeading

public float getMultipliedLeading()
Gets the variable leading.

Returns: the leading

getPaddingBottom

public float getPaddingBottom()
Getter for property paddingBottom.

Returns: Value of property paddingBottom.

getPaddingLeft

public float getPaddingLeft()

Returns: Value of property paddingLeft.

getPaddingRight

public float getPaddingRight()
Getter for property paddingRight.

Returns: Value of property paddingRight.

getPaddingTop

public float getPaddingTop()
Getter for property paddingTop.

Returns: Value of property paddingTop.

getPhrase

public Phrase getPhrase()
Gets the Phrase from this cell.

Returns: the Phrase

getRightIndent

public float getRightIndent()
Gets the right paragraph lines indent.

Returns: the indent

getRotation

public int getRotation()
Gets the rotation of the cell.

Returns: the rotation of the cell.

getRowspan

public int getRowspan()
Getter for property rowspan.

Returns: Value of property rowspan.

Since: 2.1.6

getRunDirection

public int getRunDirection()
Gets the run direction of the text content in the cell

Returns: One of the following values: PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL.

getSpaceCharRatio

public float getSpaceCharRatio()
Gets the space/character extra spacing ratio for fully justified text.

Returns: the space/character extra spacing ratio

getTable

public PdfPTable getTable()
Getter for property table.

Returns: Value of property table.

Since: 2.x

getVerticalAlignment

public int getVerticalAlignment()
Gets the vertical alignment for the cell.

Returns: the vertical alignment for the cell

hasFixedHeight

public boolean hasFixedHeight()
Tells you whether the cell has a fixed height.

Returns: true is a fixed height was set.

Since: 2.1.5

hasMinimumHeight

public boolean hasMinimumHeight()
Tells you whether the cell has a minimum height.

Returns: true if a minimum height was set.

Since: 2.1.5

isNoWrap

public boolean isNoWrap()
Getter for property noWrap.

Returns: Value of property noWrap.

isUseAscender

public boolean isUseAscender()
Gets state of first line height based on max ascender

Returns: true if an ascender is to be used.

isUseBorderPadding

public boolean isUseBorderPadding()
If true, then effective padding will include border widths

Returns: true if effective padding includes border widths

isUseDescender

public boolean isUseDescender()
Getter for property useDescender.

Returns: Value of property useDescender.

setArabicOptions

public void setArabicOptions(int arabicOptions)
Sets the arabic shaping options. The option can be AR_NOVOWEL, AR_COMPOSEDTASHKEEL and AR_LIG.

Parameters: arabicOptions the arabic shaping options

setCellEvent

public void setCellEvent(PdfPCellEvent cellEvent)
Sets the cell event for this cell.

Parameters: cellEvent the cell event

setColspan

public void setColspan(int colspan)
Setter for property colspan.

Parameters: colspan New value of property colspan.

setColumn

public void setColumn(ColumnText column)
Sets the columntext in the cell.

Parameters: column

setExtraParagraphSpace

public void setExtraParagraphSpace(float extraParagraphSpace)
Sets the extra space between paragraphs.

Parameters: extraParagraphSpace the extra space between paragraphs

setFixedHeight

public void setFixedHeight(float fixedHeight)
Set a fixed height for the cell. This will automatically unset minimumHeight, if set.

Parameters: fixedHeight New value of property fixedHeight.

setFollowingIndent

public void setFollowingIndent(float indent)
Sets the following paragraph lines indent.

Parameters: indent the indent

setHorizontalAlignment

public void setHorizontalAlignment(int horizontalAlignment)
Sets the horizontal alignment for the cell. It could be Element.ALIGN_CENTER for example.

Parameters: horizontalAlignment The horizontal alignment

setImage

public void setImage(Image image)
Setter for property image.

Parameters: image New value of property image.

setIndent

public void setIndent(float indent)
Sets the first paragraph line indent.

Parameters: indent the indent

setLeading

public void setLeading(float fixedLeading, float multipliedLeading)
Sets the leading fixed and variable. The resultant leading will be: fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the size of the biggest font in the line.

Parameters: fixedLeading the fixed leading multipliedLeading the variable leading

setMinimumHeight

public void setMinimumHeight(float minimumHeight)
Set a minimum height for the cell. This will automatically unset fixedHeight, if set.

Parameters: minimumHeight New value of property minimumHeight.

setNoWrap

public void setNoWrap(boolean noWrap)
Setter for property noWrap.

Parameters: noWrap New value of property noWrap.

setPadding

public void setPadding(float padding)
Sets the padding of the contents in the cell (space between content and border).

Parameters: padding

setPaddingBottom

public void setPaddingBottom(float paddingBottom)
Setter for property paddingBottom.

Parameters: paddingBottom New value of property paddingBottom.

setPaddingLeft

public void setPaddingLeft(float paddingLeft)
Setter for property paddingLeft.

Parameters: paddingLeft New value of property paddingLeft.

setPaddingRight

public void setPaddingRight(float paddingRight)
Setter for property paddingRight.

Parameters: paddingRight New value of property paddingRight.

setPaddingTop

public void setPaddingTop(float paddingTop)
Setter for property paddingTop.

Parameters: paddingTop New value of property paddingTop.

setPhrase

public void setPhrase(Phrase phrase)
Sets the Phrase for this cell.

Parameters: phrase the Phrase

setRightIndent

public void setRightIndent(float indent)
Sets the right paragraph lines indent.

Parameters: indent the indent

setRotation

public void setRotation(int rotation)
Sets the rotation of the cell. Possible values are 0, 90, 180 and 270.

Parameters: rotation the rotation of the cell

setRowspan

public void setRowspan(int rowspan)
Setter for property rowspan.

Parameters: rowspan New value of property rowspan.

Since: 2.1.6

setRunDirection

public void setRunDirection(int runDirection)
Sets the run direction of the text content in the cell. May be either of: PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL.

Parameters: runDirection

setSpaceCharRatio

public void setSpaceCharRatio(float spaceCharRatio)
Sets the ratio between the extra word spacing and the extra character spacing when the text is fully justified. Extra word spacing will grow spaceCharRatio times more than extra character spacing. If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO then the extra character spacing will be zero.

Parameters: spaceCharRatio the ratio between the extra word spacing and the extra character spacing

setTable

void setTable(PdfPTable table)

setUseAscender

public void setUseAscender(boolean useAscender)
Enables/ Disables adjustment of first line height based on max ascender.

Parameters: useAscender adjust height if true

setUseBorderPadding

public void setUseBorderPadding(boolean use)
Adjusts effective padding to include border widths.

Parameters: use adjust effective padding if true

setUseDescender

public void setUseDescender(boolean useDescender)
Setter for property useDescender.

Parameters: useDescender New value of property useDescender.

setVerticalAlignment

public void setVerticalAlignment(int verticalAlignment)
Sets the vertical alignment for the cell. It could be Element.ALIGN_MIDDLE for example.

Parameters: verticalAlignment The vertical alignment