Package com.lowagie.text
Class SimpleTable
java.lang.Object
com.lowagie.text.Rectangle
com.lowagie.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 com.lowagie.text.Rectangle
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, useVariableBordersFields 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, 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.voidaddElement(SimpleCell element) Adds content to this object.Creates a PdfPTable object based on this TableAttributes object.Creates a Table 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 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, 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
-
addElement
Adds content to this object.- Parameters:
element-- Throws:
BadElementException
-
createTable
Creates a Table object based on this TableAttributes object.- Returns:
- a com.lowagie.text.Table object
- Throws:
BadElementException
-
createPdfPTable
Creates a PdfPTable object based on this TableAttributes object.- Returns:
- a com.lowagie.text.pdf.PdfPTable object
- Throws:
DocumentException
-
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
public float getWidth()Description copied from class:RectangleReturns the width of the rectangle. -
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
public int type()Description copied from class:RectangleGets the type of the text element. -
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:
-