/** * Constructs a <CODE>PdfPCell</CODE> with a <CODE>PdfPtable</CODE>. This constructor allows * nested tables. * * @param table The <CODE>PdfPTable</CODE> * @param style The style to apply to the cell (you could use getDefaultCell()) * @since 2.1.0 */ public PdfPCell(PdfPTable table, PdfPCell style) { super(0, 0, 0, 0); borderWidth = 0.5f; border = BOX; column.setLeading(0, 1); this.table = table; table.setWidthPercentage(100); table.setExtendLastRow(true); column.addElement(table); if (style != null) { cloneNonPositionParameters(style); verticalAlignment = style.verticalAlignment; paddingLeft = style.paddingLeft; paddingRight = style.paddingRight; paddingTop = style.paddingTop; paddingBottom = style.paddingBottom; colspan = style.colspan; rowspan = style.rowspan; cellEvent = style.cellEvent; useDescender = style.useDescender; useBorderPadding = style.useBorderPadding; rotation = style.rotation; } else { setPadding(0); } }
void setTable(PdfPTable table) { this.table = table; column.setText(null); image = null; if (table != null) { table.setExtendLastRow(verticalAlignment == Element.ALIGN_TOP); column.addElement(table); table.setWidthPercentage(100); } }
/** * Sets the vertical alignment for the cell. It could be <CODE>Element.ALIGN_MIDDLE</CODE> for * example. * * @param verticalAlignment The vertical alignment */ public void setVerticalAlignment(int verticalAlignment) { if (table != null) table.setExtendLastRow(verticalAlignment == Element.ALIGN_TOP); this.verticalAlignment = verticalAlignment; }