java.lang.Objectcom.pdfjet.Table
public class Table
Used to create table objects and draw them on a page. Please see Example_08.
Field Summary | |
---|---|
static int |
DATA_HAS_0_HEADER_ROWS
|
static int |
DATA_HAS_1_HEADER_ROWS
|
static int |
DATA_HAS_2_HEADER_ROWS
|
static int |
DATA_HAS_3_HEADER_ROWS
|
static int |
DATA_HAS_4_HEADER_ROWS
|
static int |
DATA_HAS_5_HEADER_ROWS
|
static int |
DATA_HAS_6_HEADER_ROWS
|
static int |
DATA_HAS_7_HEADER_ROWS
|
static int |
DATA_HAS_8_HEADER_ROWS
|
static int |
DATA_HAS_9_HEADER_ROWS
|
Constructor Summary | |
---|---|
Table()
Create a table object. |
Method Summary | |
---|---|
void |
autoAdjustColumnWidths()
Auto adjusts the widths of all columns so that they are just wide enough to hold the text without truncation. |
Point |
drawOn(Page page)
Draws this table on the specified page. |
Cell |
getCellAt(int row,
int col)
Returns the cell at the specified row and column. |
Cell |
getCellAtRowColumn(int row,
int col)
Returns the cell at the specified row and column. |
java.util.List<Cell> |
getColumn(int index)
Returns a list of cell for the specified column. |
java.util.List<Cell> |
getColumnAtIndex(int index)
|
float |
getColumnWidth(int index)
Returns the column width of the column at the specified index. |
int |
getNumberOfPages(Page page)
Returns the total number of pages that are required to draw this table on. |
java.util.List<Cell> |
getRow(int index)
Returns a list of cell for the specified row. |
java.util.List<Cell> |
getRowAtIndex(int index)
|
int |
getRowsRendered()
Returns the number of data rows that have been rendered so far. |
float |
getWidth()
Returns the width of this table when drawn on a page. |
boolean |
hasMoreData()
Returns true if the table contains more data that needs to be drawn on a page. |
void |
removeLineBetweenRows(int index1,
int index2)
Removes the horizontal lines between the rows from index1 to index2. |
void |
resetRenderedPagesCount()
Resets the rendered pages count. |
void |
rightAlignNumbers()
Sets the alignment of the numbers to the right. |
void |
setBottomMargin(double bottom_margin)
Sets the bottom margin for this table. |
void |
setBottomMargin(float bottom_margin)
Sets the bottom margin for this table. |
void |
setCellBordersColor(int color)
Sets the color of the cell border lines. |
void |
setCellBordersWidth(float width)
Sets the width of the cell border lines. |
void |
setColumnWidth(int index,
float width)
Sets the width of the column with the specified index. |
void |
setData(java.util.List<java.util.List<Cell>> tableData)
Sets the table data. |
void |
setData(java.util.List<java.util.List<Cell>> tableData,
int numOfHeaderRows)
Sets the table data and specifies the number of header rows in this data. |
void |
setFontInColumn(int index,
Font font)
Sets the font for the specified column. |
void |
setFontInRow(int index,
Font font)
Sets the font for the specified row. |
void |
setLocation(float x,
float y)
Sets the location (x, y) of the top left corner of this table on the page. |
void |
setNoCellBorders()
Sets all table cells borders to false. |
void |
setPosition(double x,
double y)
Sets the position (x, y) of the top left corner of this table on the page. |
void |
setPosition(float x,
float y)
Sets the position (x, y) of the top left corner of this table on the page. |
void |
setTextAlignInColumn(int index,
int alignment)
Sets the text alignment in the specified column. |
void |
setTextColorInColumn(int index,
int color)
Sets the color of the text in the specified column. |
void |
setTextColorInRow(int index,
int color)
Sets the color of the text in the specified row. |
void |
wrapAroundCellText()
Wraps around the text in all cells so it fits the column width. |
void |
wrapAroundCellText2()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DATA_HAS_0_HEADER_ROWS
public static final int DATA_HAS_1_HEADER_ROWS
public static final int DATA_HAS_2_HEADER_ROWS
public static final int DATA_HAS_3_HEADER_ROWS
public static final int DATA_HAS_4_HEADER_ROWS
public static final int DATA_HAS_5_HEADER_ROWS
public static final int DATA_HAS_6_HEADER_ROWS
public static final int DATA_HAS_7_HEADER_ROWS
public static final int DATA_HAS_8_HEADER_ROWS
public static final int DATA_HAS_9_HEADER_ROWS
Constructor Detail |
---|
public Table()
Method Detail |
---|
public void setPosition(double x, double y)
x
- the x coordinate of the top left point of the table.y
- the y coordinate of the top left point of the table.public void setPosition(float x, float y)
x
- the x coordinate of the top left point of the table.y
- the y coordinate of the top left point of the table.public void setLocation(float x, float y)
x
- the x coordinate of the top left point of the table.y
- the y coordinate of the top left point of the table.public void setBottomMargin(double bottom_margin)
bottom_margin
- the margin.public void setBottomMargin(float bottom_margin)
bottom_margin
- the margin.public void setData(java.util.List<java.util.List<Cell>> tableData) throws java.lang.Exception
tableData
- the table data.
java.lang.Exception
public void setData(java.util.List<java.util.List<Cell>> tableData, int numOfHeaderRows) throws java.lang.Exception
tableData
- the table data.numOfHeaderRows
- the number of header rows in this data.
java.lang.Exception
public void autoAdjustColumnWidths()
public void rightAlignNumbers()
public void removeLineBetweenRows(int index1, int index2) throws java.lang.Exception
java.lang.Exception
public void setTextAlignInColumn(int index, int alignment) throws java.lang.Exception
index
- the index of the specified column.alignment
- the specified alignment. Supported values: Align.LEFT, Align.RIGHT, Align.CENTER and Align.JUSTIFY.
java.lang.Exception
public void setTextColorInColumn(int index, int color) throws java.lang.Exception
index
- the index of the specified column.color
- the color specified as an integer.
java.lang.Exception
public void setFontInColumn(int index, Font font) throws java.lang.Exception
index
- the column index.font
- the font.
java.lang.Exception
public void setTextColorInRow(int index, int color) throws java.lang.Exception
index
- the index of the specified row.color
- the color specified as an integer.
java.lang.Exception
public void setFontInRow(int index, Font font) throws java.lang.Exception
index
- the row index.font
- the font.
java.lang.Exception
public void setColumnWidth(int index, float width) throws java.lang.Exception
index
- the index of specified column.width
- the specified width.
java.lang.Exception
public float getColumnWidth(int index) throws java.lang.Exception
index
- the index of the column.
java.lang.Exception
public Cell getCellAt(int row, int col) throws java.lang.Exception
row
- the specified row.col
- the specified column.
java.lang.Exception
public Cell getCellAtRowColumn(int row, int col) throws java.lang.Exception
row
- the specified row.col
- the specified column.
java.lang.Exception
public java.util.List<Cell> getRow(int index) throws java.lang.Exception
index
- the index of the specified row.
java.lang.Exception
public java.util.List<Cell> getRowAtIndex(int index) throws java.lang.Exception
java.lang.Exception
public java.util.List<Cell> getColumn(int index) throws java.lang.Exception
index
- the index of the specified column.
java.lang.Exception
public java.util.List<Cell> getColumnAtIndex(int index) throws java.lang.Exception
java.lang.Exception
public int getNumberOfPages(Page page) throws java.lang.Exception
page
- the type of pages we are drawing this table on.
java.lang.Exception
public Point drawOn(Page page) throws java.lang.Exception
page
- the page to draw this table on.
java.lang.Exception
public boolean hasMoreData()
public float getWidth()
public int getRowsRendered()
public void wrapAroundCellText()
public void setNoCellBorders()
public void setCellBordersColor(int color)
color
- the color of the cell border lines.public void setCellBordersWidth(float width)
width
- the width of the border lines.public void resetRenderedPagesCount()
public void wrapAroundCellText2()