|
Gnostice PDFOne
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gnostice.pdfone.PdfCell
This class represents a cell in a
table
. Using the method
PdfTable.addCell(PdfCell)
, cells can
be added to a table.
// Create a PDF page PdfPage page = new PdfPage(); // Create a table PdfTable tb = new PdfTable( 3, new double[] { 1, 2, 2}, 0.5, PdfMeasurement.MU_INCHES); // Specify cell padding tb.setCellBottomMargin(0.1); tb.setCellTopMargin(0.1); tb.setCellLeftMargin(0.1); tb.setCellRightMargin(0.1); // Create a PDF font PdfFont fHelveticaBold = PdfFont.create("Helvetica", PdfFont.BOLD, 12, PdfEncodings.CP1252); fHelveticaBold.setColor(Color.BLACK); // Create cells PdfCell cell11 = new PdfCell(1,1,Color.LIGHT_GRAY, PdfTextFormatter.CENTER); cell11.setFont(fHelveticaBold); PdfCell cell12 = (PdfCell) cell11.clone(); PdfCell cell13 = (PdfCell) cell11.clone(); PdfCell cell21 = new PdfCell(1,1); PdfCell cell22 = (PdfCell) cell21.clone(); PdfCell cell23 = (PdfCell) cell11.clone(); PdfCell cell31 = (PdfCell) cell21.clone(); PdfCell cell32 = (PdfCell) cell21.clone(); PdfCell cell33 = (PdfCell) cell21.clone(); // Specify text displayed in the cells cell11.setText("S.No."); cell12.setText("First Name"); cell13.setText("Second Name"); cell21.setText("1."); cell22.setText("George"); cell23.setText("Washington"); cell31.setText("2."); cell32.setText("Abraham"); cell33.setText("Lincoln"); // Add the cells to the table tb.addCell(cell11); tb.addCell(cell12); tb.addCell(cell13); tb.addCell(cell21); tb.addCell(cell22); tb.addCell(cell23); tb.addCell(cell31); tb.addCell(cell32); tb.addCell(cell33); // Add the table to the page page.addTable(tb, 100, 100);
Field Summary | |
boolean |
fitImageinCell
Whether images need to be stretched to fit inside the cell. |
Constructor Summary | |
PdfCell(int rowSpan,
int colSpan)
Constructs a cell that spans specified rows and columns. |
|
PdfCell(int rowSpan,
int colSpan,
Color backgroundColor,
int alignment)
Constructs a cell that spans specified number of rows and columns and with specified background color and content alignment. |
Method Summary | |
Object |
clone()
|
void |
fitImageinCell(boolean fitImageinCell)
|
int |
getAlignment()
Returns constant specifying how contents of the cell are aligned. |
Color |
getBackgroundColor()
Returns background color of the cell. |
double |
getCellBottomMargin()
Returns bottom padding of the cell. |
double |
getCellLeftMargin()
Returns left padding of the cell. |
double |
getCellRightMargin()
Returns right padding of the cell. |
double |
getCellTopMargin()
Returns top padding of the cell. |
int |
getColSpan()
Returns number of cells the cell spans. |
PdfFont |
getFont()
Returns default font with which text is rendered inside the cell. |
PdfFormField |
getFormField()
|
double |
getHeight()
Returns height of the cell. |
PdfImage |
getImage()
|
int |
getRowSpan()
Returns number of rows the cells spans. |
String |
getText()
Returns text that is displayed inside the cell. |
double |
getWidth()
Returns width of the cell. |
boolean |
isFitImageinCell()
|
void |
setAlignment(int alignment)
Specifies how contents of the cells are aligned. |
void |
setBackgroundColor(Color backgroundColor)
Specifies background color of the cell. |
void |
setCellBottomMargin(double cellBottomMargin)
Specifies bottom padding of the cell. |
void |
setCellLeftMargin(double cellLeftMargin)
Specifies left padding of the cell. |
void |
setCellRightMargin(double cellRightMargin)
Specifies right padding of the cell. |
void |
setCellTopMargin(double cellTopMargin)
Specifies top padding of the cell. |
void |
setColSpan(int colSpan)
Specifies number of columns the cell spans. |
void |
setFont(PdfFont font)
Specifies default font with which text needs rendered inside the cell. |
void |
setFormField(PdfFormField formfield)
|
void |
setHeight(double height)
Specifies height of the cell. |
void |
setImage(PdfImage image)
|
void |
setRowSpan(int rowSpan)
Specifies number of rows the cell spans. |
void |
setText(String text)
Specifies text that needs to be displayed inside the cell. |
void |
setWidth(double width)
Specifies width of the cell. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean fitImageinCell
Constructor Detail |
public PdfCell(int rowSpan, int colSpan)
rowSpan
- number of rows that the cell needs to spancolSpan
- number of columns that the cell needs to spanpublic PdfCell(int rowSpan, int colSpan, Color backgroundColor, int alignment)
rowSpan
- number of rows that the cell needs to spancolSpan
- number of columns that the cell needs to spanbackgroundColor
- background color of the cellalignment
- PdfTextFormatter.LEFT
specifying alignment
of the cell's contentsMethod Detail |
public void setWidth(double width)
width
- width of the cellgetWidth()
public void setHeight(double height)
height
- height of the cellgetHeight()
,
setWidth(double)
public void setRowSpan(int rowSpan)
rowSpan
- number of rows the cell spansgetRowSpan()
public void setColSpan(int colSpan)
colSpan
- number of columns the cell spansgetColSpan()
public void setText(String text)
text
- text that needs to be displayed inside the cellgetText()
public void setCellLeftMargin(double cellLeftMargin)
cellLeftMargin
- left padding of the cellgetCellLeftMargin()
public void setCellRightMargin(double cellRightMargin)
cellRightMargin
- right padding of the cellgetCellRightMargin()
public void setCellBottomMargin(double cellBottomMargin)
cellBottomMargin
- bottom padding of the cellgetCellBottomMargin()
public void setCellTopMargin(double cellTopMargin)
cellTopMargin
- top padding of the cellgetCellTopMargin()
public double getCellLeftMargin()
setCellLeftMargin(double)
public double getCellRightMargin()
setCellRightMargin(double)
public double getCellTopMargin()
setCellTopMargin(double)
public double getCellBottomMargin()
setCellBottomMargin(double)
public String getText()
setText(String)
public int getColSpan()
setColSpan(int)
public double getHeight()
setHeight(double)
,
getWidth()
public int getRowSpan()
setRowSpan(int)
public double getWidth()
setWidth(double)
public int getAlignment()
PdfTextFormatter
,
setAlignment(int)
public void setAlignment(int alignment)
alignment
- constant specifying how contents of the cells are
alignedgetAlignment()
,
PdfTextFormatter
public Color getBackgroundColor()
setBackgroundColor(Color)
public void setBackgroundColor(Color backgroundColor)
backgroundColor
- background color of the cellgetBackgroundColor()
public void setFont(PdfFont font)
font
- default font with which text needs rendered inside
the cellgetFont()
public PdfFont getFont()
setFont(PdfFont)
public void setFormField(PdfFormField formfield)
public PdfFormField getFormField()
public void setImage(PdfImage image)
public PdfImage getImage()
public void fitImageinCell(boolean fitImageinCell)
public boolean isFitImageinCell()
public Object clone()
|
Pro. Ed. v5.0.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |