Package com.lowagie.text.pdf
Class PdfPCell
java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.text.pdf.PdfPCell
- All Implemented Interfaces:
Element
A cell in a PdfPTable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PdfPCellEvent
Holds value of property cellEvent.private int
Holds value of property colspan.private ColumnText
private float
Fixed height of the cell.private Image
Holds value of property image.private float
Minimum height of the cell.private boolean
Holds value of property noWrap.private float
Bottom padding of the cell.private float
Left padding of the cell.private float
Right padding of the cell.private float
Top padding of the cell.protected Phrase
The text in the cell.private int
The rotation of the cell.private int
Holds value of property rowspan.private PdfPTable
Holds value of property table.private boolean
Increases padding to include border if trueprivate boolean
Holds value of property useDescender.private int
Vertical alignment of the cell.Fields inherited from class com.lowagie.text.Rectangle
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, offsetToTop, RIGHT, TOP, UNDEFINED, urx, ury, useVariableBorders
Fields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MODIFICATIONDATE, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
-
Constructor Summary
ConstructorsConstructorDescriptionPdfPCell()
Constructs an emptyPdfPCell
.Constructs aPdfPCell
with anImage
.Constructs aPdfPCell
with anImage
.Constructs a deep copy of aPdfPCell
.Constructs aPdfPCell
with aPdfPtable
.Constructs aPdfPCell
with aPdfPtable
.Constructs aPdfPCell
with aPhrase
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(Element element) Adds an iText element to the cell.(package private) void
consumeHeight
(float height) Consumes part of the content of the cell.int
Gets the arabic shaping options.Gets the cell event for this cell.int
Getter for property colspan.Gets the ColumnText with the content of the cell.Returns the list of composite elements of the column.float
Gets the effective bottom padding.float
Gets the effective left padding.float
Gets the effective right padding.float
Gets the effective top padding.float
Gets the extra space between paragraphs.float
Get the fixed height of the cell.float
Gets the following paragraph lines indent.int
Gets the horizontal alignment for the cell.getImage()
Getter for property image.float
Gets the first paragraph line indent.float
Gets the fixed leading.float
Returns the height of the cell.float
Get the minimum height of the cell.float
Gets the variable leading.float
Getter for property paddingBottom.float
float
Getter for property paddingRight.float
Getter for property paddingTop.Gets thePhrase
from this cell.float
Gets the right paragraph lines indent.int
Gets the rotation of the cell.int
Getter for property rowspan.int
Gets the run direction of the text content in the cellfloat
Gets the space/character extra spacing ratio for fully justified text.getTable()
Getter for property table.int
Gets the vertical alignment for the cell.boolean
Tells you whether the cell has a fixed height.boolean
Tells you whether the cell has a minimum height.boolean
isNoWrap()
Getter for property noWrap.boolean
Gets state of first line height based on max ascenderboolean
If true, then effective padding will include border widthsboolean
Getter for property useDescender.void
setArabicOptions
(int arabicOptions) Sets the arabic shaping options.void
setCellEvent
(PdfPCellEvent cellEvent) Sets the cell event for this cell.void
setColspan
(int colspan) Setter for property colspan.void
setColumn
(ColumnText column) Sets the ColumnText in the cell.void
setExtraParagraphSpace
(float extraParagraphSpace) Sets the extra space between paragraphs.void
setFixedHeight
(float fixedHeight) Set a fixed height for the cell.void
setFollowingIndent
(float indent) Sets the following paragraph lines indent.void
setHorizontalAlignment
(int horizontalAlignment) Sets the horizontal alignment for the cell.void
Setter for property image.void
setIndent
(float indent) Sets the first paragraph line indent.void
setLeading
(float fixedLeading, float multipliedLeading) Sets the leading fixed and variable.void
setMinimumHeight
(float minimumHeight) Set a minimum height for the cell.void
setNoWrap
(boolean noWrap) Setter for property noWrap.void
setPadding
(float padding) Sets the padding of the contents in the cell (space between content and border).void
setPaddingBottom
(float paddingBottom) Setter for property paddingBottom.void
setPaddingLeft
(float paddingLeft) Setter for property paddingLeft.void
setPaddingRight
(float paddingRight) Setter for property paddingRight.void
setPaddingTop
(float paddingTop) Setter for property paddingTop.void
Sets thePhrase
for this cell.void
setRightIndent
(float indent) Sets the right paragraph lines indent.void
setRotation
(int rotation) Sets the rotation of the cell.void
setRowspan
(int rowspan) Setter for property rowspan.void
setRunDirection
(int runDirection) Sets the run direction of the text content in the cell.void
setSpaceCharRatio
(float spaceCharRatio) Sets the ratio between the extra word spacing and the extra character spacing when the text is fully justified.(package private) void
void
setUseAscender
(boolean useAscender) Enables/ Disables adjustment of first line height based on max ascender.void
setUseBorderPadding
(boolean use) Adjusts effective padding to include border widths.void
setUseDescender
(boolean useDescender) Setter for property useDescender.void
setVerticalAlignment
(int verticalAlignment) Sets the vertical alignment for the cell.Methods inherited from class com.lowagie.text.Rectangle
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRelativeTop, getRight, getRight, getTop, getTop, getWidth, hasBorder, hasBorders, isContent, isNestable, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRelativeTop, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString, type
-
Field Details
-
phrase
The text in the cell. -
column
-
verticalAlignment
private int verticalAlignmentVertical alignment of the cell. -
paddingLeft
private float paddingLeftLeft padding of the cell. -
paddingRight
private float paddingRightRight padding of the cell. -
paddingTop
private float paddingTopTop padding of the cell. -
paddingBottom
private float paddingBottomBottom padding of the cell. -
fixedHeight
private float fixedHeightFixed height of the cell. -
minimumHeight
private float minimumHeightMinimum height of the cell. -
noWrap
private boolean noWrapHolds value of property noWrap. -
table
Holds value of property table. -
colspan
private int colspanHolds value of property colspan. -
rowspan
private int rowspanHolds value of property rowspan.- Since:
- 2.1.6
-
image
Holds value of property image. -
cellEvent
Holds value of property cellEvent. -
useDescender
private boolean useDescenderHolds value of property useDescender. -
useBorderPadding
private boolean useBorderPaddingIncreases padding to include border if true -
rotation
private int rotationThe rotation of the cell. Possible values are 0, 90, 180 and 270.
-
-
Constructor Details
-
PdfPCell
public PdfPCell()Constructs an emptyPdfPCell
. The default padding is 2. -
PdfPCell
Constructs aPdfPCell
with aPhrase
. The default padding is 2.- Parameters:
phrase
- the text
-
PdfPCell
Constructs aPdfPCell
with anImage
. The default padding is 0.- Parameters:
image
- theImage
-
PdfPCell
Constructs aPdfPCell
with anImage
. The default padding is 0.25 for a border width of 0.5.- Parameters:
image
- theImage
fit
-true
to fit the image to the cell
-
PdfPCell
Constructs aPdfPCell
with aPdfPtable
. This constructor allows nested tables. The default padding is 0.- Parameters:
table
- ThePdfPTable
-
PdfPCell
Constructs aPdfPCell
with aPdfPtable
. This constructor allows nested tables.- Parameters:
table
- ThePdfPTable
style
- The style to apply to the cell (you could use getDefaultCell())- Since:
- 2.1.0
-
PdfPCell
Constructs a deep copy of aPdfPCell
.- Parameters:
cell
- thePdfPCell
to duplicate
-
-
Method Details
-
addElement
Adds an iText element to the cell.- Parameters:
element
- the iText element to add to the cell
-
getPhrase
Gets thePhrase
from this cell.- Returns:
- the
Phrase
-
setPhrase
Sets thePhrase
for this cell.- Parameters:
phrase
- thePhrase
-
getHorizontalAlignment
public int getHorizontalAlignment()Gets the horizontal alignment for the cell.- Returns:
- the horizontal alignment for the cell
-
setHorizontalAlignment
public void setHorizontalAlignment(int horizontalAlignment) Sets the horizontal alignment for the cell. It could beElement.ALIGN_CENTER
for example.- Parameters:
horizontalAlignment
- The horizontal alignment
-
getVerticalAlignment
public int getVerticalAlignment()Gets the vertical alignment for the cell.- Returns:
- the vertical alignment for the cell
-
setVerticalAlignment
public void setVerticalAlignment(int verticalAlignment) Sets the vertical alignment for the cell. It could beElement.ALIGN_MIDDLE
for example.- Parameters:
verticalAlignment
- The vertical alignment
-
getEffectivePaddingLeft
public float getEffectivePaddingLeft()Gets the effective left padding. This will include the left border width ifisUseBorderPadding()
is true.- Returns:
- effective value of property paddingLeft.
-
getPaddingLeft
public float getPaddingLeft()- Returns:
- Value of property paddingLeft.
-
setPaddingLeft
public void setPaddingLeft(float paddingLeft) Setter for property paddingLeft.- Parameters:
paddingLeft
- New value of property paddingLeft.
-
getEffectivePaddingRight
public float getEffectivePaddingRight()Gets the effective right padding. This will include the right border width ifisUseBorderPadding()
is true.- Returns:
- effective value of property paddingRight.
-
getPaddingRight
public float getPaddingRight()Getter for property paddingRight.- Returns:
- Value of property paddingRight.
-
setPaddingRight
public void setPaddingRight(float paddingRight) Setter for property paddingRight.- Parameters:
paddingRight
- New value of property paddingRight.
-
getEffectivePaddingTop
public float getEffectivePaddingTop()Gets the effective top padding. This will include the top border width ifisUseBorderPadding()
is true.- Returns:
- effective value of property paddingTop.
-
getPaddingTop
public float getPaddingTop()Getter for property paddingTop.- Returns:
- Value of property paddingTop.
-
setPaddingTop
public void setPaddingTop(float paddingTop) Setter for property paddingTop.- Parameters:
paddingTop
- New value of property paddingTop.
-
getEffectivePaddingBottom
public float getEffectivePaddingBottom()Gets the effective bottom padding. This will include the bottom border width ifisUseBorderPadding()
is true.- Returns:
- effective value of property paddingBottom.
-
getPaddingBottom
public float getPaddingBottom()Getter for property paddingBottom.- Returns:
- Value of property paddingBottom.
-
setPaddingBottom
public void setPaddingBottom(float paddingBottom) Setter for property paddingBottom.- Parameters:
paddingBottom
- New value of property paddingBottom.
-
setPadding
public void setPadding(float padding) Sets the padding of the contents in the cell (space between content and border).- Parameters:
padding
- the padding
-
isUseBorderPadding
public boolean isUseBorderPadding()If true, then effective padding will include border widths- Returns:
- true if effective padding includes border widths
-
setUseBorderPadding
public void setUseBorderPadding(boolean use) Adjusts effective padding to include border widths.- Parameters:
use
- adjust effective padding if true
-
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 leadingmultipliedLeading
- the variable leading
-
getLeading
public float getLeading()Gets the fixed leading.- Returns:
- the leading
-
getMultipliedLeading
public float getMultipliedLeading()Gets the variable leading.- Returns:
- the leading
-
getIndent
public float getIndent()Gets the first paragraph line indent.- Returns:
- the indent
-
setIndent
public void setIndent(float indent) Sets the first paragraph line indent.- Parameters:
indent
- the indent
-
getExtraParagraphSpace
public float getExtraParagraphSpace()Gets the extra space between paragraphs.- Returns:
- the extra space between paragraphs
-
setExtraParagraphSpace
public void setExtraParagraphSpace(float extraParagraphSpace) Sets the extra space between paragraphs.- Parameters:
extraParagraphSpace
- the extra space between paragraphs
-
getFixedHeight
public float getFixedHeight()Get the fixed height of the cell.- Returns:
- Value of property fixedHeight.
-
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.
-
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
-
getMinimumHeight
public float getMinimumHeight()Get the minimum height of the cell.- Returns:
- Value of property minimumHeight.
-
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.
-
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.
-
setNoWrap
public void setNoWrap(boolean noWrap) Setter for property noWrap.- Parameters:
noWrap
- New value of property noWrap.
-
getTable
Getter for property table.- Returns:
- Value of property table.
- Since:
- 2.x
-
setTable
-
getColspan
public int getColspan()Getter for property colspan.- Returns:
- Value of property colspan.
-
setColspan
public void setColspan(int colspan) Setter for property colspan.- Parameters:
colspan
- New value of property colspan.
-
getRowspan
public int getRowspan()Getter for property rowspan.- Returns:
- Value of property rowspan.
- Since:
- 2.1.6
-
setRowspan
public void setRowspan(int rowspan) Setter for property rowspan.- Parameters:
rowspan
- New value of property rowspan.- Since:
- 2.1.6
-
getFollowingIndent
public float getFollowingIndent()Gets the following paragraph lines indent.- Returns:
- the indent
-
setFollowingIndent
public void setFollowingIndent(float indent) Sets the following paragraph lines indent.- Parameters:
indent
- the indent
-
getRightIndent
public float getRightIndent()Gets the right paragraph lines indent.- Returns:
- the indent
-
setRightIndent
public void setRightIndent(float indent) Sets the right paragraph lines indent.- Parameters:
indent
- the indent
-
getSpaceCharRatio
public float getSpaceCharRatio()Gets the space/character extra spacing ratio for fully justified text.- Returns:
- the space/character extra spacing ratio
-
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 growspaceCharRatio
times more than extra character spacing. If the ratio isPdfWriter.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
-
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.
-
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
- the run direction (see above)
-
getImage
Getter for property image.- Returns:
- Value of property image.
-
setImage
Setter for property image.- Parameters:
image
- New value of property image.
-
getCellEvent
Gets the cell event for this cell.- Returns:
- the cell event
-
setCellEvent
Sets the cell event for this cell.- Parameters:
cellEvent
- the cell event
-
getArabicOptions
public int getArabicOptions()Gets the arabic shaping options.- Returns:
- the arabic shaping options
-
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
-
isUseAscender
public boolean isUseAscender()Gets state of first line height based on max ascender- Returns:
- true if an ascender is to be used.
-
setUseAscender
public void setUseAscender(boolean useAscender) Enables/ Disables adjustment of first line height based on max ascender.- Parameters:
useAscender
- adjust height if true
-
isUseDescender
public boolean isUseDescender()Getter for property useDescender.- Returns:
- Value of property useDescender.
-
setUseDescender
public void setUseDescender(boolean useDescender) Setter for property useDescender.- Parameters:
useDescender
- New value of property useDescender.
-
getColumn
Gets the ColumnText with the content of the cell.- Returns:
- a columntext object
-
setColumn
Sets the ColumnText in the cell.- Parameters:
column
- the ColumnText to put in the cell
-
getCompositeElements
Returns the list of composite elements of the column.- Returns:
- a List object.
- Since:
- 2.1.1
-
getRotation
public int getRotation()Gets the rotation of the cell.- Overrides:
getRotation
in classRectangle
- Returns:
- the rotation of the cell.
-
setRotation
public void setRotation(int rotation) Sets the rotation of the cell. Possible values are 0, 90, 180 and 270.- Overrides:
setRotation
in classRectangle
- Parameters:
rotation
- the rotation of the cell
-
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
-
getMaxHeight
public float getMaxHeight()Returns the height of the cell.- Returns:
- the height of the cell
- Since:
- 3.0.0
-