Package com.lowagie.text.pdf
Class PdfPRow
java.lang.Object
com.lowagie.text.pdf.PdfPRow
A row in a PdfPTable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
the bottom limit (bottom right y)protected boolean
private int[]
protected PdfPCell[]
protected float[]
extra heights that needs to be added to a cell because of rowspans.protected float
static final float
the right limitprotected float[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Calculates the heights of each cell in the row.PdfPCell[]
getCells()
Returns the array of cells in the row.(package private) float[]
getEventWidth
(float xPos) float
Gets the maximum height of the row (i.e.void
Initializes the extra heights array.boolean
Checks if the dimensions of the columns were calculated.protected void
restoreCanvases
(PdfContentByte[] canvases) protected void
saveAndRotateCanvases
(PdfContentByte[] canvases, float a, float b, float c, float d, float e, float f) static float
setColumn
(ColumnText ct, float left, float bottom, float right, float top) void
setExtraHeight
(int cell, float height) Sets an extra height for a cell.void
setMaxHeights
(float maxHeight) Changes the maximum height of the row (to make it higher).boolean
setWidths
(float[] widths) Sets the widths of the columns in the row.Splits a row to newHeight.void
writeBorderAndBackground
(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) Writes the border and background of one cell in the row.void
writeCells
(int colStart, int colEnd, float xPos, float yPos, PdfContentByte[] canvases) Writes a number of cells (not necessarily all cells).
-
Field Details
-
BOTTOM_LIMIT
public static final float BOTTOM_LIMITthe bottom limit (bottom right y)- See Also:
-
RIGHT_LIMIT
public static final float RIGHT_LIMITthe right limit- Since:
- 2.1.5
- See Also:
-
cells
-
widths
protected float[] widths -
extraHeights
protected float[] extraHeightsextra heights that needs to be added to a cell because of rowspans.- Since:
- 2.1.6
-
maxHeight
protected float maxHeight -
calculated
protected boolean calculated -
canvasesPos
private int[] canvasesPos
-
-
Constructor Details
-
PdfPRow
Constructs a new PdfPRow with the cells in the array that was passed as a parameter.- Parameters:
cells
- an array of PdfCell to put into the PdfRow
-
PdfPRow
Makes a copy of an existing row.- Parameters:
row
- the PdfRow to copy
-
-
Method Details
-
setColumn
- Parameters:
ct
- the ColumnTextleft
- the left positionbottom
- the bottom positionright
- the right positiontop
- the top position- Returns:
- a float of the top position
- Since:
- 3.0.0 protected is now public static
-
setWidths
public boolean setWidths(float[] widths) Sets the widths of the columns in the row.- Parameters:
widths
- The width of the columns- Returns:
- true if everything went right
-
initExtraHeights
public void initExtraHeights()Initializes the extra heights array.- Since:
- 2.1.6
-
setExtraHeight
public void setExtraHeight(int cell, float height) Sets an extra height for a cell.- Parameters:
cell
- the index of the cell that needs an extra heightheight
- the extra height- Since:
- 2.1.6
-
calculateHeights
public float calculateHeights()Calculates the heights of each cell in the row.- Returns:
- the maximum height of the row.
-
writeBorderAndBackground
public void writeBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) Writes the border and background of one cell in the row.- Parameters:
xPos
- The x-coordinate where the table starts on the canvasyPos
- The y-coordinate where the table starts on the canvascurrentMaxHeight
- The height of the cell to be drawn.cell
- The cell to changecanvases
- The canvases- Since:
- 2.1.6 extra parameter currentMaxHeight
-
saveAndRotateCanvases
protected void saveAndRotateCanvases(PdfContentByte[] canvases, float a, float b, float c, float d, float e, float f) - Parameters:
canvases
- The canvases to save and rotatea
- an element of the transformation matrixb
- an element of the transformation matrixc
- an element of the transformation matrixd
- an element of the transformation matrixe
- an element of the transformation matrixf
- an element of the transformation matrix- Since:
- 2.1.6 private is now protected
-
restoreCanvases
- Parameters:
canvases
- a array of PdfContentByte- Since:
- 2.1.6 private is now protected
-
writeCells
Writes a number of cells (not necessarily all cells).- Parameters:
colStart
- The first column to be written. Remember that the column index starts with 0.colEnd
- The last column to be written. Remember that the column index starts with 0. If -1, all the columns to the end are written.xPos
- The x-coordinate where the table starts on the canvasyPos
- The y-coordinate where the table starts on the canvascanvases
- a PdfContentByte array of the canvases
-
isCalculated
public boolean isCalculated()Checks if the dimensions of the columns were calculated.- Returns:
- true if the dimensions of the columns were calculated
-
getMaxHeights
public float getMaxHeights()Gets the maximum height of the row (i.e. of the 'highest' cell).- Returns:
- the maximum height of the row
-
setMaxHeights
public void setMaxHeights(float maxHeight) Changes the maximum height of the row (to make it higher). (added by Jin-Hsia Yang)- Parameters:
maxHeight
- the new maximum height
-
getEventWidth
float[] getEventWidth(float xPos) -
splitRow
Splits a row to newHeight. The returned row is the remainder. It will return null if the newHeight was so small that only an empty row would result.- Parameters:
table
- the PdfTable to get the row fromrowIndex
- the row indexnew_height
- the new height- Returns:
- the remainder row or null if the newHeight was so small that only an empty row would result
-
getCells
Returns the array of cells in the row. Please be extremely careful with this method. Use the cells as read only objects.- Returns:
- an array of cells
- Since:
- 2.1.1
-