public class SimpleTable extends Rectangle implements PdfPTableEvent, TextElementArray
backgroundColor, border, borderColor, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, ury, useVariableBorders
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, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
Constructor and Description |
---|
SimpleTable()
A RectangleCell is always constructed without any dimensions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Element o)
Adds an object to the
TextElementArray . |
void |
addElement(SimpleCell element)
Adds content to this object.
|
PdfPTable |
createPdfPTable()
Creates a
PdfTable object based on this TableAttributes object. |
Table |
createTable()
Creates a Table object based on this TableAttributes object.
|
int |
getAlignment() |
float |
getCellpadding() |
float |
getCellspacing() |
float |
getWidth()
Returns the width of the rectangle.
|
float |
getWidthpercentage() |
boolean |
isNestable()
Checks if this element is nestable.
|
void |
setAlignment(int alignment) |
void |
setCellpadding(float cellpadding) |
void |
setCellspacing(float cellspacing) |
void |
setWidth(float width) |
void |
setWidthpercentage(float widthpercentage) |
void |
tableLayout(PdfPTable table,
float[][] widths,
float[] heights,
int headerRows,
int rowStart,
PdfContentByte[] canvases)
This method is called at the end of the table rendering.
|
int |
type()
Gets the type of the text element.
|
cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBackgroundColor, getBorder, getBorderColor, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidth, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getBottom, getBottom, getChunks, getGrayFill, getHeight, getLeft, getLeft, getRight, getRight, getRotation, getTop, getTop, hasBorder, hasBorders, isContent, isUseVariableBorders, normalize, process, rectangle, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setRotation, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString
public SimpleTable()
public void addElement(SimpleCell element) throws BadElementException
element
- an object of type SimpleCell
that will be added in the tableBadElementException
- on errorpublic Table createTable() throws BadElementException
Table
objectBadElementException
- on errorpublic PdfPTable createPdfPTable() throws DocumentException
PdfTable
object based on this TableAttributes object.PdfTable
objectDocumentException
- on errorpublic void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases)
PdfPTableEvent
PdfContentByte
contained in
canvases
.canvases
are:
PdfPTable.BASECANVAS
- the original PdfContentByte
. Anything placed here
will be under the table.
PdfPTable.BACKGROUNDCANVAS
- the layer where the background goes to.
PdfPTable.LINECANVAS
- the layer where the lines go to.
PdfPTable.TEXTCANVAS
- the layer where the text go to. Anything placed here
will be over the table.
The widths
and heights
have the coordinates of the cells.
The size of the widths
array is the number of rows.
Each sub-array in widths
corresponds to the x column border positions where
the first element is the x coordinate of the left table border and the last
element is the x coordinate of the right table border.
If colspan is not used all the sub-arrays in widths
are the same.
For the heights
the first element is the y coordinate of the top table border and the last
element is the y coordinate of the bottom table border.
tableLayout
in interface PdfPTableEvent
table
- the PdfPTable
in usewidths
- an array of arrays with the cells' x positions. It has the length of the number
of rowsheights
- an array with the cells' y positions. It has a length of the number
of rows + 1headerRows
- the number of rows defined for the header.rowStart
- the first row number after the headercanvases
- an array of PdfContentByte
PdfPTableEvent.tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
public float getCellpadding()
public void setCellpadding(float cellpadding)
cellpadding
- The cellpadding to set.public float getCellspacing()
public void setCellspacing(float cellspacing)
cellspacing
- The cellspacing to set.public int getAlignment()
public void setAlignment(int alignment)
alignment
- The alignment to set.public float getWidth()
Rectangle
public void setWidth(float width)
width
- The width to set.public float getWidthpercentage()
public void setWidthpercentage(float widthpercentage)
widthpercentage
- The widthpercentage to set.public int type()
Rectangle
type
in interface Element
type
in class Rectangle
Element.type()
public boolean isNestable()
Element
isNestable
in interface Element
isNestable
in class Rectangle
Element.isNestable()
public boolean add(Element o)
TextElementArray
TextElementArray
.add
in interface TextElementArray
o
- an object that has to be addedtrue
if the addition succeeded; false
otherwiseTextElementArray.add(Element)
Copyright © 2020. All rights reserved.