I am using the setCellEvent to add a text field to a cell. But after this,
the borders on my table dissappear. I am confused as to why would this
happen? I even explicity set the BorderColor and Width of the cell, but this
does not help.
Attached is a snippet of the code, I would greatly appreciate any answers.
Thanks.
float[] table5Widths = {72*4.0f, 72*4.0f};
PdfPTable table5 = new PdfPTable(table5Widths);
table5.setTotalWidth(576f);
table5.setLockedWidth(true);
PdfPTable innerTable5 = this.createCell1Table5();
currentCell = new PdfPCell(innerTable5);
currentCell.setBorderColor(Color.BLACK);
currentCell.setBorderColorLeft(Color.BLACK);
currentCell.setBorderColorRight(Color.BLACK);
currentCell.setBorderWidthLeft(2);
currentCell.setBorderWidthRight(2);
table5.addCell(currentCell);
innerTable5 = this.createCell2Table5(writer);
currentCell = new PdfPCell(innerTable5);
currentCell.setBorderWidthRight(2);
currentCell.setBorderColorRight(Color.BLACK);
table5.addCell(currentCell);
document.add(table5);
________________________________________________________________
public PdfPTable createCell2Table5(PdfWriter writer){
float[] outerTableWidths = {140f,140f};
PdfPTable outerTable = new PdfPTable(outerTableWidths);
outerTable.setTotalWidth(280f);
outerTable.setLockedWidth(true);
PdfPCell currentCell = createCellNoBorderBlack_8("4. IF COURT
JUDGEMENT, DATE OBTAINED:");
currentCell.setFixedHeight(36f);
outerTable.addCell(currentCell);
//currentCell = createCellNoBorderBlack_8("1/20/2008 thru
2/20/2008");
currentCell = getTextField(writer, new Rectangle(0,0,140,15),
"judge date", black_8, "");
currentCell.setFixedHeight(36f);
outerTable.addCell(currentCell);
return outerTable;
}
____________________________________________________________________
protected PdfPCell getTextField(PdfWriter writer, Rectangle rect, String name,
Font font, String initialText){
PdfPCell cell = new PdfPCell();
cell = new PdfPCell();
TextField t = new TextField(writer,rect,name);
t.setFont(font.getBaseFont());
t.setFieldName(name);
t.setFontSize(8);
t.setText(initialText);
try {
cell.setCellEvent(new FieldCell(t.getTextField(),
(int)rect.getWidth(), writer));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return cell;
}-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/