/** * Constructs a <CODE>PdfPCell</CODE> with a <CODE>Phrase</CODE>. The default padding is 2. * * @param phrase the text */ public PdfPCell(Phrase phrase) { super(0, 0, 0, 0); borderWidth = 0.5f; border = BOX; column.addText(this.phrase = phrase); column.setLeading(0, 1); }
/** * 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); } }
/** * Constructs a <CODE>PdfPCell</CODE> with an <CODE>Image</CODE>. The default padding is 0.25 for * a border width of 0.5. * * @param image the <CODE>Image</CODE> * @param fit <CODE>true</CODE> to fit the image to the cell */ public PdfPCell(Image image, boolean fit) { super(0, 0, 0, 0); borderWidth = 0.5f; border = BOX; column.setLeading(0, 1); if (fit) { this.image = image; setPadding(borderWidth / 2); } else { image.setScaleToFitLineWhenOverflow(false); column.addText(this.phrase = new Phrase(new Chunk(image, 0, 0, true))); setPadding(0); } }
/** * Sets the leading fixed and variable. The resultant leading will be: * fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the size of the biggest font in * the line. * * @param fixedLeading the fixed leading * @param multipliedLeading the variable leading */ public void setLeading(float fixedLeading, float multipliedLeading) { column.setLeading(fixedLeading, multipliedLeading); }
/** Constructs an empty <CODE>PdfPCell</CODE>. The default padding is 2. */ public PdfPCell() { super(0, 0, 0, 0); borderWidth = 0.5f; border = BOX; column.setLeading(0, 1); }