|
Gnostice PDFOne
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gnostice.pdfone.PdfTable
This represents a table that can be rendered on a page. After a
PdfTable
object is created, cells can be added to
it. After all cells are added, the PdfTable
object
can be added to a specified location on a page.
// Create a PDF page PdfPage page = new PdfPage(); // Create a table PdfTable tb = new PdfTable( 3, new double[] { 1, 2, 2}, 0.4, PdfMeasurement.MU_INCHES); // Specify cell padding tb.setCellBottomMargin(0.1); tb.setCellTopMargin(0.1); tb.setCellLeftMargin(0.1); tb.setCellRightMargin(0.1); // Add "Row 1" cells to the table tb.addCell(1, 1, "S.No.", Color.blue); tb.addCell(1, 1, "First Name", Color.RED); tb.addCell(1, 1, "Second Name", Color.RED); // Add "Row 2" cells to the table tb.addCell(1, 1, "1."); tb.addCell(1, 1, "Abraham"); tb.addCell(1, 1, "Lincoln"); // Add "Row 3" cells to the table tb.addCell(1, 1, "2."); tb.addCell(1, 1, "Thomas"); tb.addCell(1, 1, "Jefferson"); // Add "Row 4" cells to the table tb.addCell(2, 1, "3."); tb.addCell(1, 2, "George"); tb.addCell(1, 2, "Washington"); // Add the table to the page page.addTable(tb, 100, 100);
Constructor Summary | |
PdfTable(int columns)
Creates a table with specified number of columns. |
|
PdfTable(int columns,
double[] colwidth,
double cellHeight,
int measurementUnit)
Constructs a new table with specified number of columns, column width, column height, and default measurement unit. |
|
PdfTable(int columns,
double[] colwidth,
int measurementUnit)
Constructs a new table with specified number of columns, column width, and default measurement unit. |
Method Summary | |
void |
addCell(int rowSpan,
int colSpan)
Adds a new cell that spans specified number of rows and specified number of columns to the table. |
void |
addCell(int rowSpan,
int colSpan,
Color backgroundColor)
Add a new cell (with specified background color) that spans specified number of rows and specified number of columns to the table. |
void |
addCell(int rowSpan,
int colSpan,
PdfFormField formfield)
Adds a new cell (with specified form field as the contents) that spans specified number of rows and specified number of columns to the table. |
void |
addCell(int rowSpan,
int colSpan,
PdfImage image)
Adds a new cell (with specified image as the contents) that spans specified number of rows and specified number of columns to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text)
Adds specified cell (with specified text as contents) that spans specified number of rows and specified number of columns to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text,
Color backgroundColor)
Adds a new cell (with specified background color and contents) that spans specified number of rows and specified number of columns to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text,
Color backgroundColor,
PdfFont font,
int alignment)
Adds a new cell (that spans specified number of rows and specified number of columns) with specified text contents, text font, and text alignment to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text,
int alignment)
Adds a new cell (that spans specified number of rows and specified number of columns) with specified text contents and text alignment. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfFont font)
Adds specified (that specified number of rows and columns) with specified text and text font. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfFont font,
Color backgroundColor)
Adds specified (that specified number of rows and columns) with specified text, font for rendering the text, and background color to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfFont font,
int alignment)
Adds specified (that specified number of rows and columns) with specified text, font for rendering the text, and text alignment. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfFont font,
PdfImage image,
Color backgroundColor,
int alignment)
Adds specified (that specified number of rows and columns) with specified text content, font for rendering the text, image content, background color, and content alignment. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfFont font,
PdfImage image,
Color backgroundColor,
int alignment,
boolean fitImageinCell)
Adds a new cell (that spans specified number of rows and specified number of columns) with specified text contents, font for rendering the text, image that should be rendered inside the cell, background color, and image scaling to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfFont font,
String imagePath)
Adds a new cell (that spans specified number of rows and specified number of columns) with specified text contents, font for rendering the text, and pathaname of the image that should be rendered inside the cell. |
void |
addCell(int rowSpan,
int colSpan,
String text,
PdfImage image,
Color backgroundColor,
int alignment)
Adds specified (that specified number of rows and columns) with specified text content, font for rendering the text, image content, background color, and alignment to the table. |
void |
addCell(int rowSpan,
int colSpan,
String text,
String imagePath)
Adds specified (that specified number of rows and columns) with specified text and image contents to the table. |
void |
addCell(PdfCell c)
Adds specified cell to the table. |
int |
getAlignment()
Returns default alignment of contents of the cells in the table. |
boolean |
getAutoAdjRowHeight()
Returns whether row height of the tables will be adjusted to accommodate the entire height of the contents of the cells. |
Color |
getBackgroundColor()
Returns default background color of the cells in the table. |
double |
getCellBottomMargin()
Returns default bottom padding of the contents in the cells in the table. |
double |
getCellLeftMargin()
Returns default left padding of the contents of the cells in the table. |
double |
getCellRightMargin()
Returns default right padding of the contents of the cells in the table. |
double |
getCellTopMargin()
Returns default top padding of the contents of the cells in the table. |
double[] |
getColumnWidths()
Returns widths of all columns in the table. |
PdfFont |
getFont()
Returns defualt font used by the table. |
PdfPen |
getPen()
Returns default pen used to stroke the table. |
double |
getRowHeight()
Returns default height of the cells in the table. |
void |
setAlignment(int alignment)
Specifies how contents of cells in the table are aligned. |
void |
setAutoAdjRowHeight(boolean autoAdjColumnHeight)
Specifies whether row height of the tables need to be adjusted to accommodate the entire height of the contents of the cells. |
void |
setBackgroundColor(Color backgroundColor)
Speifies default background color of the cells in the table. |
void |
setCellBottomMargin(double cellBottomMargin)
Specifies default bottom padding of the contents of the cells in the table. |
void |
setCellLeftMargin(double cellLeftMargin)
Specifies default left padding of the contents of the cells in the table. |
void |
setCellRightMargin(double cellRightMargin)
Specifies default right padding of the contents of the cells in the table. |
void |
setCellTopMargin(double cellTopMargin)
Specifies default top padding of the contents of the cells in the table. |
void |
setColumnWidth(double[] colwidth)
Specifies widths of the columns in the table. |
void |
setFont(PdfFont font)
Specifies default font for text contents in the table. |
void |
setPen(PdfPen pen)
Specifies default pen with which contents of the table are stroked. |
void |
setRowHeight(double rowHeight)
Specifies heights of the rows in the table. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PdfTable(int columns)
columns
- number of columnspublic PdfTable(int columns, double[] colwidth, int measurementUnit) throws PdfException
columns
- number of columnscolwidth
- width of the columnsmeasurementUnit
- constant specified measurement unit with which
lengths of various properties of the table are
specified
PdfException
- if an illegal argument is supplied.public PdfTable(int columns, double[] colwidth, double cellHeight, int measurementUnit) throws PdfException
columns
- number of columnscolwidth
- width of the columnscellHeight
- height of the columnsmeasurementUnit
- constant specified measurement unit with which
lengths of various properties of the table are
specified
PdfException
- if an illegal argument is supplied.Method Detail |
public void addCell(int rowSpan, int colSpan)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spanpublic void addCell(int rowSpan, int colSpan, String text)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellpublic void addCell(int rowSpan, int colSpan, String text, PdfFont font)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellfont
- font with which the text should be rendered inside
the cellpublic void addCell(int rowSpan, int colSpan, String text, PdfFont font, int alignment)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellfont
- font with which the text should be rendered inside
the cellalignment
- constant specifying alignment of the text inside the
cellPdfTextFormatter
public void addCell(int rowSpan, int colSpan, String text, Color backgroundColor, PdfFont font, int alignment)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellbackgroundColor
- background color of the cellfont
- font with which the text should be rendered inside
the cellalignment
- constant specifying alignment of the text inside the
cellPdfTextFormatter
public void addCell(int rowSpan, int colSpan, String text, int alignment)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellalignment
- constant specifying alignment of the text inside the
cellPdfTextFormatter
public void addCell(int rowSpan, int colSpan, String text, Color backgroundColor)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellbackgroundColor
- background color of the cellpublic void addCell(int rowSpan, int colSpan, String text, PdfFont font, Color backgroundColor)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellfont
- font with which the text should be rendered inside
the cellbackgroundColor
- background color of the cellpublic void addCell(int rowSpan, int colSpan, PdfImage image)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spanimage
- image that should be rendered inside the cellpublic void addCell(int rowSpan, int colSpan, Color backgroundColor)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spanbackgroundColor
- background color of the cellpublic void addCell(int rowSpan, int colSpan, String text, String imagePath) throws IOException, PdfException
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellimagePath
- pathname of the image
IOException
- if an I/O error occurs.
PdfException
- if an illegal argument is supplied.public void addCell(int rowSpan, int colSpan, String text, PdfFont font, String imagePath) throws IOException, PdfException
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellfont
- font with which the text should be rendered inside
the cellimagePath
- pathname of the image
IOException
- if an I/O error occurs.
PdfException
- if an illegal argument is supplied.public void addCell(int rowSpan, int colSpan, String text, PdfImage image, Color backgroundColor, int alignment) throws IOException, PdfException
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellimage
- image that should be rendered inside the cellbackgroundColor
- background color of the cellalignment
- constant specifying alignment of the text inside the
cell
IOException
- if an I/O error occurs.
PdfException
- if an illegal argument is supplied.public void addCell(int rowSpan, int colSpan, String text, PdfFont font, PdfImage image, Color backgroundColor, int alignment)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellfont
- font with which the text should be rendered
inside the cellimage
- image that should be rendered inside the cellbackgroundColor
- background color of the cellalignment
- constant specifying alignment of the text inside
the cellPdfTextFormatter
public void addCell(int rowSpan, int colSpan, String text, PdfFont font, PdfImage image, Color backgroundColor, int alignment, boolean fitImageinCell)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spantext
- text that should be rendered inside the cellfont
- font with which the text should be rendered
inside the cellimage
- image that should be rendered inside the cellbackgroundColor
- background color of the cellalignment
- constant specifying alignment of the text inside
the cellfitImageinCell
- whether the image needs to scaled up or down to
fit the cellPdfTextFormatter
public void addCell(int rowSpan, int colSpan, PdfFormField formfield)
rowSpan
- number of rows that the new cell should spancolSpan
- number of columns that the new cell should spanformfield
- form field that should be rendered inside the cellpublic void addCell(PdfCell c)
c
- cell that needs to be addedpublic PdfPen getPen()
setPen(PdfPen)
public void setPen(PdfPen pen)
pen
- default pengetPen()
public boolean getAutoAdjRowHeight()
setAutoAdjRowHeight(boolean)
public void setAutoAdjRowHeight(boolean autoAdjColumnHeight)
autoAdjColumnHeight
- whether row height of the tables need to be adjustedgetAutoAdjRowHeight()
public double getCellLeftMargin()
setCellLeftMargin(double)
public void setCellLeftMargin(double cellLeftMargin)
cellLeftMargin
- default left paddinggetCellLeftMargin()
public double getCellTopMargin()
getCellTopMargin()
public void setCellTopMargin(double cellTopMargin)
cellTopMargin
- default top paddinggetCellTopMargin()
public double getCellRightMargin()
setCellRightMargin(double)
public void setCellRightMargin(double cellRightMargin)
cellRightMargin
- default right paddinggetCellRightMargin()
public double getCellBottomMargin()
setCellBottomMargin(double)
public void setCellBottomMargin(double cellBottomMargin)
cellBottomMargin
- default bottom paddinggetCellBottomMargin()
public double getRowHeight()
setRowHeight(double)
public void setRowHeight(double rowHeight)
rowHeight
- an array containing the heightsgetRowHeight()
public double[] getColumnWidths()
setColumnWidth(double[])
public void setColumnWidth(double[] colwidth)
colwidth
- an array containing the widthsgetColumnWidths()
public Color getBackgroundColor()
setBackgroundColor(Color)
public void setBackgroundColor(Color backgroundColor)
backgroundColor
- default background colorgetBackgroundColor()
public PdfFont getFont()
setFont(PdfFont)
public void setFont(PdfFont font)
font
- default fontgetFont()
public int getAlignment()
PdfTextFormatter
public void setAlignment(int alignment)
alignment
- getAlignment()
|
Pro. Ed. v5.0.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |