PdfPCell obtainCell(final int row, final int col) { PdfPCell[] cells = ((PdfPRow)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 static PdfPCell getCell( PdfPTable table, int idx ) { return table.getRow( 0 ).getCells()[idx]; }
public static PdfPCell getCell( PdfPTable table, int idx ) { return table.getRow( 0 ).getCells()[idx]; }
public static PdfPCell getCell( PdfPTable table, int idx ) { return table.getRow( 0 ).getCells()[idx]; }
public static PdfPCell getCell( PdfPTable table, int idx ) { return table.getRow( 0 ).getCells()[idx]; }
public PdfPCell getCell(PdfPTable table, int row, int col) { return table.getRow(row).getCells()[col]; }
public PdfPCell[] getColumns(PdfPTable table, int col) { PdfPCell[] columns = new PdfPCell[table.getRows().size()]; for (int rid=0; rid < table.getRows().size(); rid++) { columns[rid] = ((PdfPRow)table.getRows().get(rid)).getCells()[col]; } return columns; } }
public static void replaceTableCells( PdfPTable table ) { // replace default table cells // by fixed height cells PdfPCell[] cells = table.getRow( 0 ).getCells(); for ( int i = 0; i < cells.length; i++ ) { cells[i] = new FixedHeightPdfPCell( cells[i] ); } }
public static void replaceTableCells( PdfPTable table ) { // replace default table cells // by fixed height cells PdfPCell[] cells = table.getRow( 0 ).getCells(); for ( int i = 0; i < cells.length; i++ ) { cells[i] = new FixedHeightPdfPCell( cells[i] ); } }
public static void replaceTableCells( PdfPTable table ) { // replace default table cells // by fixed height cells PdfPCell[] cells = table.getRow( 0 ).getCells(); for ( int i = 0; i < cells.length; i++ ) { cells[i] = new FixedHeightPdfPCell( cells[i] ); } }
public static void replaceTableCells( PdfPTable table ) { // replace default table cells // by fixed height cells PdfPCell[] cells = table.getRow( 0 ).getCells(); for ( int i = 0; i < cells.length; i++ ) { cells[i] = new FixedHeightPdfPCell( cells[i] ); } }
public static void clearTable( PdfPTable table, boolean resetFixedHeight ) { for ( PdfPCell cell : table.getRow( 0 ).getCells() ) { cell.setColumn( createColumnText() ); if ( resetFixedHeight ) { cell.setFixedHeight( -1.0f ); } } }
public static void clearTable( PdfPTable table, boolean resetFixedHeight ) { for ( PdfPCell cell : table.getRow( 0 ).getCells() ) { cell.setColumn( createColumnText() ); if ( resetFixedHeight ) { cell.setFixedHeight( -1.0f ); } } }
public void setDataAlignments(int[] dataAlignments) { this.dataAlignments = dataAlignments; if (hType.equals(TBDirection.Horizontal)) { for (int ridx = 1; ridx < table.getRows().size(); ridx++) { int cidx = 0; for (int alignment : dataAlignments) { table.getRow(ridx).getCells()[cidx++].setHorizontalAlignment(alignment); } } } else if (hType.equals(TBDirection.Vertical)) { for (int ridx = 0; ridx < table.getRows().size(); ridx++) { int cidx = 1; for (int alignment : dataAlignments) { table.getRow(ridx).getCells()[cidx++].setHorizontalAlignment(alignment); } } } }
public static void clearTable( PdfPTable table, boolean resetFixedHeight ) { for ( PdfPCell cell : table.getRow( 0 ).getCells() ) { cell.setColumn( createColumnText() ); if ( resetFixedHeight ) { cell.setFixedHeight( -1.0f ); } } }
private void setBodyCell(String text, int ridx, int cidx) { PdfPCell bodyCell = table.getRow(ridx).getCells()[cidx]; bodyCell.setBackgroundColor(Color.LIGHT_GRAY); if (text != null) { bodyCell.setPhrase(tableBSelector.process(text)); } }
public static void clearTable( PdfPTable table, boolean resetFixedHeight ) { for ( PdfPCell cell : table.getRow( 0 ).getCells() ) { cell.setColumn( createColumnText() ); if ( resetFixedHeight ) { cell.setFixedHeight( -1.0f ); } } }
/** * Calculates the extra height needed in a row because of rowspans. * @param start the index of the start row (the one to adjust) * @param end the index of the end row on the page * @since 2.1.6 */ protected PdfPRow adjustCellsInRow(int start, int end) { PdfPRow row = new PdfPRow(getRow(start)); row.initExtraHeights(); PdfPCell cell; PdfPCell[] cells = row.getCells(); for (int i = 0; i < cells.length; i++) { cell = cells[i]; if (cell == null || cell.getRowspan() == 1) continue; int stop = Math.min(end, start + cell.getRowspan()); float extra = 0; for (int k = start + 1; k < stop; k++) { extra += getRowHeight(k); } row.setExtraHeight(i, extra); } return row; }
/** * Calculates the extra height needed in a row because of rowspans. * @param start the index of the start row (the one to adjust) * @param end the index of the end row on the page * @since 2.1.6 */ protected PdfPRow adjustCellsInRow(int start, int end) { PdfPRow row = new PdfPRow(getRow(start)); row.initExtraHeights(); PdfPCell cell; PdfPCell[] cells = row.getCells(); for (int i = 0; i < cells.length; i++) { cell = cells[i]; if (cell == null || cell.getRowspan() == 1) continue; int stop = Math.min(end, start + cell.getRowspan()); float extra = 0; for (int k = start + 1; k < stop; k++) { extra += getRowHeight(k); } row.setExtraHeight(i, extra); } return row; }
private void setHeaderCell(String text, int ridx, int cidx) { PdfPCell headerCell = table.getRow(ridx++).getCells()[cidx]; if (hType.equals(TBDirection.Horizontal)) { headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); } else if (hType.equals(TBDirection.Vertical)) { headerCell.setHorizontalAlignment(Element.ALIGN_RIGHT); } headerCell.setVerticalAlignment(Element.ALIGN_MIDDLE); headerCell.setBackgroundColor(Color.GRAY); headerCell.setPhrase(tableHSelector.process(text)); }