Class SimpleTable
java.lang.Object
com.aowagie.text.Rectangle
com.aowagie.text.SimpleTable
- All Implemented Interfaces:
Element, PdfPTableEvent, TextElementArray
Rectangle that can be used for Cells.
This Rectangle is padded and knows how to draw itself in a PdfPTable or PdfPcellEvent.
-
Field Summary
Fields inherited from class Rectangle
border, borderWidth, BOTTOM, BOX, LEFT, llx, lly, NO_BORDER, RIGHT, rotation, TOP, UNDEFINED, urx, uryFields inherited from interface 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, 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds an object to theTextElementArray.Creates a PdfPTable object based on this TableAttributes object.intfloatfloatfloatgetWidth()Returns the width of the rectangle.floatbooleanChecks if this element is nestable.voidsetAlignment(int alignment) voidsetCellpadding(float cellpadding) voidsetCellspacing(float cellspacing) voidsetWidth(float width) voidsetWidthpercentage(float widthpercentage) voidtableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases) This method is called at the end of the table rendering.inttype()Gets the type of the text element.Methods inherited from class Rectangle
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, setTop, setUseVariableBorders, softCloneNonPositionParameters, toString
-
Constructor Details
-
SimpleTable
public SimpleTable()A RectangleCell is always constructed without any dimensions. Dimensions are defined after creation.
-
-
Method Details
-
createPdfPTable
Creates a PdfPTable object based on this TableAttributes object.- Returns:
- a com.aowagie.text.pdf.PdfPTable object
- Throws:
DocumentException- Exception with information about the error
-
tableLayout
public void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases) Description copied from interface:PdfPTableEventThis method is called at the end of the table rendering. The text or graphics are added to one of the 4PdfContentBytecontained incanvases.
The indexes tocanvasesare:PdfPTable.BASECANVAS- the originalPdfContentByte. 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
widthsandheightshave the coordinates of the cells.
The size of thewidthsarray is the number of rows. Each sub-array inwidthscorresponds 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 inwidthsare the same.
For theheightsthe first element is the y coordinate of the top table border and the last element is the y coordinate of the bottom table border.- Specified by:
tableLayoutin interfacePdfPTableEvent- Parameters:
table- thePdfPTablein 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 ofPdfContentByte- See Also:
-
getCellpadding
public float getCellpadding()- Returns:
- Returns the cellpadding.
-
setCellpadding
public void setCellpadding(float cellpadding) - Parameters:
cellpadding- The cellpadding to set.
-
getCellspacing
public float getCellspacing()- Returns:
- Returns the cellspacing.
-
setCellspacing
public void setCellspacing(float cellspacing) - Parameters:
cellspacing- The cellspacing to set.
-
getAlignment
public int getAlignment()- Returns:
- Returns the alignment.
-
setAlignment
public void setAlignment(int alignment) - Parameters:
alignment- The alignment to set.
-
getWidth
-
setWidth
public void setWidth(float width) - Parameters:
width- The width to set.
-
getWidthpercentage
public float getWidthpercentage()- Returns:
- Returns the widthpercentage.
-
setWidthpercentage
public void setWidthpercentage(float widthpercentage) - Parameters:
widthpercentage- The widthpercentage to set.
-
type
-
isNestable
public boolean isNestable()Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein interfaceElement- Overrides:
isNestablein classRectangle- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-
add
Description copied from interface:TextElementArrayAdds an object to theTextElementArray.- Specified by:
addin interfaceTextElementArray- Parameters:
o- an object that has to be added- Returns:
trueif the addition succeeded;falseotherwise- See Also:
-