diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java index 7ab3fc43e..c04c5e635 100644 --- a/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java +++ b/openpdf/src/main/java/com/lowagie/text/pdf/PdfPTable.java @@ -443,7 +443,7 @@ public PdfPCell getDefaultCell() { * * @param cell the cell element */ - public void addCell(PdfPCell cell) { + public PdfPCell addCell(PdfPCell cell) { rowCompleted = false; PdfPCell ncell = new PdfPCell(cell); @@ -499,6 +499,8 @@ public void addCell(PdfPCell cell) { currentRow[currentRowIdx] = ncell; currentRowIdx += colspan; } + + return ncell; } /** @@ -579,8 +581,8 @@ boolean rowSpanAbove(int currRow, int currCol) { * * @param text the text for the cell */ - public void addCell(String text) { - addCell(new Phrase(text)); + public PdfPCell addCell(String text) { + return addCell(new Phrase(text)); } /** @@ -588,10 +590,11 @@ public void addCell(String text) { * * @param table the table to be added to the cell */ - public void addCell(PdfPTable table) { + public PdfPCell addCell(PdfPTable table) { defaultCell.setTable(table); addCell(defaultCell); defaultCell.setTable(null); + return defaultCell; } /** @@ -600,10 +603,11 @@ public void addCell(PdfPTable table) { * @param image the Image to add to the table. * This image will fit in the cell */ - public void addCell(Image image) { + public PdfPCell addCell(Image image) { defaultCell.setImage(image); addCell(defaultCell); defaultCell.setImage(null); + return defaultCell; } /** @@ -611,10 +615,11 @@ public void addCell(Image image) { * * @param phrase the Phrase to be added to the cell */ - public void addCell(Phrase phrase) { + public PdfPCell addCell(Phrase phrase) { defaultCell.setPhrase(phrase); addCell(defaultCell); defaultCell.setPhrase(null); + return defaultCell; } /**