/** * Adds a cell element. * * @param cell the cell element */ public void addCell(PdfPCell cell) { PdfPCell ncell = new PdfPCell(cell); int colspan = ncell.getColspan(); colspan = Math.max(colspan, 1); colspan = Math.min(colspan, currentRow.length - currentRowIdx); ncell.setColspan(colspan); if (colspan != 1) isColspan = true; int rdir = ncell.getRunDirection(); if (rdir == PdfWriter.RUN_DIRECTION_DEFAULT) ncell.setRunDirection(runDirection); currentRow[currentRowIdx] = ncell; currentRowIdx += colspan; if (currentRowIdx >= currentRow.length) { if (runDirection == PdfWriter.RUN_DIRECTION_RTL) { PdfPCell rtlRow[] = new PdfPCell[absoluteWidths.length]; int rev = currentRow.length; for (int k = 0; k < currentRow.length; ++k) { PdfPCell rcell = currentRow[k]; int cspan = rcell.getColspan(); rev -= cspan; rtlRow[rev] = rcell; k += cspan - 1; } currentRow = rtlRow; } PdfPRow row = new PdfPRow(currentRow); if (totalWidth > 0) { row.setWidths(absoluteWidths); totalHeight += row.getMaxHeights(); } rows.add(row); currentRow = new PdfPCell[absoluteWidths.length]; currentRowIdx = 0; } }
/** * Adds a cell element. * * @param phrase the <CODE>Phrase</CODE> to be added to the cell */ public void addCell(Phrase phrase) { defaultCell.setPhrase(phrase); addCell(defaultCell); defaultCell.setPhrase(null); }
/** * Adds an Image as Cell. * * @param image the <CODE>Image</CODE> to add to the table. This image will fit in the cell */ public void addCell(Image image) { defaultCell.setImage(image); addCell(defaultCell); defaultCell.setImage(null); }
/** * Adds a nested table. * * @param table the table to be added to the cell */ public void addCell(PdfPTable table) { defaultCell.setTable(table); addCell(defaultCell); defaultCell.setTable(null); }