Class Cell<T extends org.apache.pdfbox.pdmodel.PDPage>
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddContentDrawnListener(CellContentDrawnListener<T> listener) voidcopyCellStyle(Cell sourceCell) Copies the style of an existing cell to this cellgetAlign()floatGets cell's bottom padding (in points).floatGets the height of the single cell, opposed togetHeight(), which returns the row's height.floatGets fill (background)Colorfor the current cell.org.apache.pdfbox.pdmodel.font.PDFontgetFont()Gets appropriatePDFontfor current cell.org.apache.pdfbox.pdmodel.font.PDFontfloatGetsPDFontsize for current cell (in points).floatGets the cell's height according toRow's heightfloatGets free horizontal space of cell.floatGets cell's height without (top,bottom) padding.floatGets cell's width without (left,right) padding.floatGets cell's left padding (in points).floatRetrieves a validParagraphdepending of cell'sPDFontand value rotation.floatGets cell's right padding (in points).getText()Retrieves text from current cellRetrieves cell's textColor.floatGetsParagraph's heightfloatGetsParagraph's widthfloatGets cell's top padding (in points).getUrl()floatGets free vertical space of cell.floatgetWidth()Gets cell's width.hasSameStyle(Cell sourceCell) Compares the style of a cell with another cellbooleanbooleanbooleanvoidnotifyContentDrawnListeners(org.apache.pdfbox.pdmodel.PDDocument document, org.apache.pdfbox.pdmodel.PDPage page, org.apache.pdfbox.pdmodel.common.PDRectangle rectangle) voidsetAlign(HorizontalAlignment align) voidsetBorderStyle(LineStyle border) Easy setting for cell border style.voidsetBottomBorderStyle(LineStyle bottomBorder) voidsetBottomPadding(float cellBottomPadding) Sets cell's bottom padding (in points)voidsetColspanCell(boolean isColspanCell) voidsetFillColor(Color fillColor) Sets fill (background)Colorfor the current cell.voidsetFont(org.apache.pdfbox.pdmodel.font.PDFont font) Sets appropriatePDFontfor current cell.voidsetFontBold(org.apache.pdfbox.pdmodel.font.PDFont fontBold) Sets the font used for bold text, for example in header cells.voidsetFontSize(float fontSize) SetsPDFontsize for current cell (in points).voidsetHeaderCell(boolean isHeaderCell) voidSets the height of the single cell.voidsetLeftBorderStyle(LineStyle leftBorder) voidsetLeftPadding(float cellLeftPadding) Sets cell's left padding (in points)voidsetLineSpacing(float lineSpacing) voidsetRightBorderStyle(LineStyle rightBorder) voidsetRightPadding(float cellRightPadding) Sets cell's right padding (in points)voidSets cell's text valuevoidsetTextColor(Color textColor) Sets cell's textColor.voidsetTextRotated(boolean textRotated) voidsetTopBorderStyle(LineStyle topBorder) voidsetTopPadding(float cellTopPadding) Sets cell's top padding (in points)voidvoidsetValign(VerticalAlignment valign) voidsetWidth(float width) voidsetWrappingFunction(WrappingFunction wrappingFunction)
-
Method Details
-
getTextColor
Retrieves cell's text
Color. Default color is black.- Returns:
Colorof the cell's text
-
setTextColor
Sets cell's text
Color.- Parameters:
textColor- designated textColor
-
getFillColor
Gets fill (background)
Colorfor the current cell.- Returns:
- Fill
Colorfor the cell
-
setFillColor
Sets fill (background)
Colorfor the current cell.- Parameters:
fillColor- FillColorfor the cell
-
getWidth
public float getWidth()Gets cell's width.
- Returns:
- Cell's width
-
getInnerWidth
public float getInnerWidth()Gets cell's width without (left,right) padding.
- Returns:
- Inner cell's width
-
getInnerHeight
public float getInnerHeight()Gets cell's height without (top,bottom) padding.
- Returns:
- Inner cell's height
-
getText
Retrieves text from current cell
- Returns:
- cell's text
-
setText
Sets cell's text value
- Parameters:
text- Text value of the cell
-
getFont
public org.apache.pdfbox.pdmodel.font.PDFont getFont()Gets appropriate
PDFontfor current cell.- Returns:
PDFontfor current cell- Throws:
IllegalArgumentException- iffontis not set.
-
setFont
public void setFont(org.apache.pdfbox.pdmodel.font.PDFont font) Sets appropriate
PDFontfor current cell.- Parameters:
font-PDFontfor current cell
-
getFontSize
public float getFontSize()Gets
PDFontsize for current cell (in points).- Returns:
PDFontsize for current cell (in points).
-
setFontSize
public void setFontSize(float fontSize) Sets
PDFontsize for current cell (in points).- Parameters:
fontSize-PDFontsize for current cell (in points).
-
getParagraph
Retrieves a valid
Paragraphdepending of cell'sPDFontand value rotation.If cell has rotated value then
Paragraphwidth is depending ofgetInnerHeight()otherwisegetInnerWidth()- Returns:
- Cell's
Paragraph
-
getExtraWidth
public float getExtraWidth() -
getHeight
public float getHeight()Gets the cell's height according to
Row's height- Returns:
Row's height
-
getCellHeight
public float getCellHeight()Gets the height of the single cell, opposed to
getHeight(), which returns the row's height.Depending of rotated/normal cell's value there is two cases for calculation:
- Rotated value - cell's height is equal to overall text length in the cell with necessery paddings (top,bottom)
- Normal value - cell's height is equal to
Paragraph's height with necessery paddings (top,bottom)
- Returns:
- Cell's height
- Throws:
IllegalStateException- iffontis not set.
-
setHeight
Sets the height of the single cell.
- Parameters:
height- Cell's height
-
getTextHeight
public float getTextHeight()Gets
Paragraph's height- Returns:
Paragraph's height
-
getTextWidth
public float getTextWidth()Gets
Paragraph's width- Returns:
Paragraph's width
-
getLeftPadding
public float getLeftPadding()Gets cell's left padding (in points).
- Returns:
- Cell's left padding (in points).
-
setLeftPadding
public void setLeftPadding(float cellLeftPadding) Sets cell's left padding (in points)
- Parameters:
cellLeftPadding- Cell's left padding (in points).
-
getRightPadding
public float getRightPadding()Gets cell's right padding (in points).
- Returns:
- Cell's right padding (in points).
-
setRightPadding
public void setRightPadding(float cellRightPadding) Sets cell's right padding (in points)
- Parameters:
cellRightPadding- Cell's right padding (in points).
-
getTopPadding
public float getTopPadding()Gets cell's top padding (in points).
- Returns:
- Cell's top padding (in points).
-
setTopPadding
public void setTopPadding(float cellTopPadding) Sets cell's top padding (in points)
- Parameters:
cellTopPadding- Cell's top padding (in points).
-
getBottomPadding
public float getBottomPadding()Gets cell's bottom padding (in points).
- Returns:
- Cell's bottom padding (in points).
-
setBottomPadding
public void setBottomPadding(float cellBottomPadding) Sets cell's bottom padding (in points)
- Parameters:
cellBottomPadding- Cell's bottom padding (in points).
-
getVerticalFreeSpace
public float getVerticalFreeSpace()Gets free vertical space of cell.
If cell has rotated value then free vertical space is equal inner cell's height (
getInnerHeight()) subtracted to the longest line of rotatedParagraphotherwise it's just cell's inner height (getInnerHeight()) subtracted with width of the normalParagraph.- Returns:
- Free vertical space of the cell's.
-
getHorizontalFreeSpace
public float getHorizontalFreeSpace()Gets free horizontal space of cell.
If cell has rotated value then free horizontal space is equal cell's inner width (
getInnerWidth()) subtracted to theParagraph's height otherwise it's just cell'sgetInnerWidth()subtracted with width of longest line in normalParagraph.- Returns:
- Free vertical space of the cell's.
-
getAlign
-
getValign
-
isHeaderCell
public boolean isHeaderCell() -
setHeaderCell
public void setHeaderCell(boolean isHeaderCell) -
getWrappingFunction
-
setWrappingFunction
-
getLeftBorder
-
getRightBorder
-
getTopBorder
-
getBottomBorder
-
setLeftBorderStyle
-
setRightBorderStyle
-
setTopBorderStyle
-
setBottomBorderStyle
-
setBorderStyle
Easy setting for cell border style.
- Parameters:
border- It isLineStylefor all borders- See Also:
-
isTextRotated
public boolean isTextRotated() -
setTextRotated
public void setTextRotated(boolean textRotated) -
getFontBold
public org.apache.pdfbox.pdmodel.font.PDFont getFontBold() -
setFontBold
public void setFontBold(org.apache.pdfbox.pdmodel.font.PDFont fontBold) Sets the font used for bold text, for example in header cells.
- Parameters:
fontBold- The font to use for bold text
-
isColspanCell
public boolean isColspanCell() -
setColspanCell
public void setColspanCell(boolean isColspanCell) -
setAlign
-
setValign
-
copyCellStyle
Copies the style of an existing cell to this cell
- Parameters:
sourceCell- SourceCellfrom which cell style will be copied.
-
hasSameStyle
Compares the style of a cell with another cell
- Parameters:
sourceCell- SourceCellwhich will be used for style comparation- Returns:
- boolean if source cell has the same style
-
setWidth
public void setWidth(float width) -
getLineSpacing
public float getLineSpacing() -
setLineSpacing
public void setLineSpacing(float lineSpacing) -
addContentDrawnListener
-
getCellContentDrawnListeners
-
notifyContentDrawnListeners
public void notifyContentDrawnListeners(org.apache.pdfbox.pdmodel.PDDocument document, org.apache.pdfbox.pdmodel.PDPage page, org.apache.pdfbox.pdmodel.common.PDRectangle rectangle) -
getUrl
-
setUrl
-