if (cells[k] != null) { n++; k += cells[k].getColspan(); } else { while (k < cells.length && cells[k] == null) { for (int k = 0; k < cells.length && n < width.length;) { if (cells[k] != null) { int colspan = cells[k].getColspan(); width[n] = width[n - 1]; for (int i = 0; i < colspan && k < absoluteWidths.length; i++) {
if (cells[k] != null) { n++; k += cells[k].getColspan(); } else { while (k < cells.length && cells[k] == null) { for (int k = 0; k < cells.length && n < width.length;) { if (cells[k] != null) { int colspan = cells[k].getColspan(); width[n] = width[n - 1]; for (int i = 0; i < colspan && k < absoluteWidths.length; i++) {
/** * Added by timmo3. This will return the correct cell taking it's cellspan * into account * * @param row the row index * @param col the column index * @return PdfPCell at the given row and position or null otherwise */ PdfPCell cellAt(final int row, final int col) { PdfPCell[] cells = rows.get(row).getCells(); for (int i = 0; i < cells.length; i++) { if (cells[i] != null) { if (col >= i && col < (i + cells[i].getColspan())) { return cells[i]; } } } return null; }
/** * Added by timmo3. This will return the correct cell taking it's cellspan * into account * * @param row the row index * @param col the column index * @return PdfPCell at the given row and position or null otherwise */ PdfPCell cellAt(final int row, final int col) { PdfPCell[] cells = rows.get(row).getCells(); for (int i = 0; i < cells.length; i++) { if (cells[i] != null) { if (col >= i && col < (i + cells[i].getColspan())) { return cells[i]; } } } return null; }
public void beginCell(PdfPCell cell, float completedRowsHeight, float rowHeight) { rowspan = cell.getRowspan(); colspan = cell.getColspan(); height = completedRowsHeight + Math.max(cell.hasCachedMaxHeight() ? cell.getCachedMaxHeight() : cell.getMaxHeight(), rowHeight); }
public void beginCell(PdfPCell cell, float completedRowsHeight, float rowHeight) { rowspan = cell.getRowspan(); colspan = cell.getColspan(); height = completedRowsHeight + Math.max(cell.hasCachedMaxHeight() ? cell.getCachedMaxHeight() : cell.getMaxHeight(), rowHeight); }
/** * Sets the widths of the columns in the row. * * @param widths * @return true if everything went right */ public boolean setWidths(float widths[]) { if (widths.length != cells.length) { return false; } System.arraycopy(widths, 0, this.widths, 0, cells.length); float total = 0; calculated = false; for (int k = 0; k < widths.length; ++k) { PdfPCell cell = cells[k]; if (cell == null) { total += widths[k]; continue; } cell.setLeft(total); int last = k + cell.getColspan(); for (; k < last; ++k) { total += widths[k]; } --k; cell.setRight(total); cell.setTop(0); } return true; }
/** * Sets the widths of the columns in the row. * * @param widths * @return true if everything went right */ public boolean setWidths(float widths[]) { if (widths.length != cells.length) { return false; } System.arraycopy(widths, 0, this.widths, 0, cells.length); float total = 0; calculated = false; for (int k = 0; k < widths.length; ++k) { PdfPCell cell = cells[k]; if (cell == null) { total += widths[k]; continue; } cell.setLeft(total); int last = k + cell.getColspan(); for (; k < last; ++k) { total += widths[k]; } --k; cell.setRight(total); cell.setTop(0); } return true; }
ncol += pc.getColspan();
ncol += pc.getColspan();
int colspan = ncell.getColspan(); colspan = Math.max(colspan, 1); colspan = Math.min(colspan, currentRow.length - currentColIdx); for (int k = 0; k < currentRow.length; ++k) { PdfPCell rcell = currentRow[k]; int cspan = rcell.getColspan(); rev -= cspan; rtlRow[rev] = rcell;
int colspan = ncell.getColspan(); colspan = Math.max(colspan, 1); colspan = Math.min(colspan, currentRow.length - currentColIdx); for (int k = 0; k < currentRow.length; ++k) { PdfPCell rcell = currentRow[k]; int cspan = rcell.getColspan(); rev -= cspan; rtlRow[rev] = rcell;
@SuppressWarnings("unchecked") @Override public void process(int level, Node node, InvocationContext context) { TreeNavigation nav = context.treeNavigation(); boolean isHeaderRow = nav.ancestorTreeMatches(TableRowNode.class, TableHeaderNode.class); List<Element> elements = context.collectChildren(level, node); TableInfos tableInfos = context.peekTable(); PdfPTable table = tableInfos.getTable(); int col = 0; for (Element element : elements) { PdfPCell cell = (PdfPCell) element; cell.setHorizontalAlignment(tableInfos.columnAlignment(col)); table.addCell(cell); col += cell.getColspan(); } table.completeRow(); if (isHeaderRow) { int headerRows = table.getHeaderRows(); table.setHeaderRows(headerRows + 1); } } }
i += cells[i].getColspan();
i += cells[i].getColspan();
private void writeAttributes(final PdfPCell cell) { if (cell != null) { this.setAttribute(PdfName.O, PdfName.TABLE); if (cell.getColspan() != 1){ this.setAttribute(PdfName.COLSPAN, new PdfNumber(cell.getColspan()));
private void writeAttributes(final PdfPCell cell) { if (cell != null) { this.setAttribute(PdfName.O, PdfName.TABLE); if (cell.getColspan() != 1){ this.setAttribute(PdfName.COLSPAN, new PdfNumber(cell.getColspan()));