/** * @param index the 0-based index * @return the cell at the given index * @throws IndexOutOfBoundsException if there is no cell at the given index */ public HtmlTableCell getCell(final int index) throws IndexOutOfBoundsException { int count = 0; for (final HtmlTableCell cell : getCellIterator()) { if (count == index) { return cell; } count++; } throw new IndexOutOfBoundsException("No cell found for index " + index + "."); }
/** * @param index the 0-based index * @return the cell at the given index * @throws IndexOutOfBoundsException if there is no cell at the given index */ public HtmlTableCell getCell(final int index) throws IndexOutOfBoundsException { int count = 0; for (final HtmlTableCell cell : getCellIterator()) { if (count == index) { return cell; } count++; } throw new IndexOutOfBoundsException("No cell found for index " + index + "."); }
/** * @return an immutable list containing all the HtmlTableCells held by this object * @see #getCellIterator */ public List<HtmlTableCell> getCells() { final List<HtmlTableCell> result = new ArrayList<>(); for (final HtmlTableCell cell : getCellIterator()) { result.add(cell); } return Collections.unmodifiableList(result); }
/** * @return an immutable list containing all the HtmlTableCells held by this object * @see #getCellIterator */ public List<HtmlTableCell> getCells() { final List<HtmlTableCell> result = new ArrayList<>(); for (final HtmlTableCell cell : getCellIterator()) { result.add(cell); } return Collections.unmodifiableList(result); }
/** * @return an immutable list containing all the HtmlTableCells held by this object * @see #getCellIterator */ public List<HtmlTableCell> getCells() { final List<HtmlTableCell> result = new ArrayList<HtmlTableCell>(); for (final CellIterator iterator = getCellIterator(); iterator.hasNext();) { result.add(iterator.next()); } return Collections.unmodifiableList(result); }
/** * @return an immutable list containing all the HtmlTableCells held by this object * @see #getCellIterator */ public List<HtmlTableCell> getCells() { final List<HtmlTableCell> result = new ArrayList<HtmlTableCell>(); for (final CellIterator iterator = getCellIterator(); iterator.hasNext();) { result.add(iterator.next()); } return Collections.unmodifiableList(result); }
/** * @return an immutable list containing all the HtmlTableCells held by this object * @see #getCellIterator */ public List<HtmlTableCell> getCells() { final List<HtmlTableCell> result = new ArrayList<HtmlTableCell>(); for (final CellIterator iterator = getCellIterator(); iterator.hasNext();) { result.add(iterator.next()); } return Collections.unmodifiableList(result); }
/** * @param index the 0-based index * @return the cell at the given index * @throws IndexOutOfBoundsException if there is no cell at the given index */ public HtmlTableCell getCell(final int index) throws IndexOutOfBoundsException { int count = 0; for (final CellIterator iterator = getCellIterator(); iterator.hasNext(); count++) { final HtmlTableCell next = iterator.nextCell(); if (count == index) { return next; } } throw new IndexOutOfBoundsException(); }
/** * @param index the 0-based index * @return the cell at the given index * @throws IndexOutOfBoundsException if there is no cell at the given index */ public HtmlTableCell getCell(final int index) throws IndexOutOfBoundsException { int count = 0; for (final CellIterator iterator = getCellIterator(); iterator.hasNext(); count++) { final HtmlTableCell next = iterator.nextCell(); if (count == index) { return next; } } throw new IndexOutOfBoundsException(); }
/** * @param index the 0-based index * @return the cell at the given index * @throws IndexOutOfBoundsException if there is no cell at the given index */ public HtmlTableCell getCell(final int index) throws IndexOutOfBoundsException { int count = 0; for (final CellIterator iterator = getCellIterator(); iterator.hasNext(); count++) { final HtmlTableCell next = iterator.nextCell(); if (count == index) { return next; } } throw new IndexOutOfBoundsException(); }
int row = 0; for (final HtmlTableRow htmlTableRow : rowIterator) { final HtmlTableRow.CellIterator cellIterator = htmlTableRow.getCellIterator(); int col = 0; for (final HtmlTableCell cell : cellIterator) {
int row = 0; for (final HtmlTableRow htmlTableRow : rowIterator) { final HtmlTableRow.CellIterator cellIterator = htmlTableRow.getCellIterator(); int col = 0; for (final HtmlTableCell cell : cellIterator) {
/** * Returns the first cell that matches the specified row and column, searching left to right, top to bottom. * * @param rowIndex the row index * @param columnIndex the column index * @return the HtmlTableCell at that location or null if there are no cells at that location */ public final HtmlTableCell getCellAt(final int rowIndex, final int columnIndex) { final RowIterator rowIterator = getRowIterator(); for (int rowNo = 0; rowIterator.hasNext(); rowNo++) { final HtmlTableRow row = rowIterator.nextRow(); final HtmlTableRow.CellIterator cellIterator = row.getCellIterator(); for (int colNo = 0; cellIterator.hasNext(); colNo++) { final HtmlTableCell cell = cellIterator.nextCell(); if (rowNo <= rowIndex && rowNo + cell.getRowSpan() > rowIndex) { if (colNo <= columnIndex && colNo + cell.getColumnSpan() > columnIndex) { return cell; } } } } return null; }
/** * Returns the first cell that matches the specified row and column, searching left to right, top to bottom. * * @param rowIndex the row index * @param columnIndex the column index * @return the HtmlTableCell at that location or null if there are no cells at that location */ public final HtmlTableCell getCellAt(final int rowIndex, final int columnIndex) { final RowIterator rowIterator = getRowIterator(); for (int rowNo = 0; rowIterator.hasNext(); rowNo++) { final HtmlTableRow row = rowIterator.nextRow(); final HtmlTableRow.CellIterator cellIterator = row.getCellIterator(); for (int colNo = 0; cellIterator.hasNext(); colNo++) { final HtmlTableCell cell = cellIterator.nextCell(); if (rowNo <= rowIndex && rowNo + cell.getRowSpan() > rowIndex) { if (colNo <= columnIndex && colNo + cell.getColumnSpan() > columnIndex) { return cell; } } } } return null; }
/** * Returns the first cell that matches the specified row and column, searching left to right, top to bottom. * * @param rowIndex the row index * @param columnIndex the column index * @return the HtmlTableCell at that location or null if there are no cells at that location */ public final HtmlTableCell getCellAt(final int rowIndex, final int columnIndex) { final RowIterator rowIterator = getRowIterator(); for (int rowNo = 0; rowIterator.hasNext(); rowNo++) { final HtmlTableRow row = rowIterator.nextRow(); final HtmlTableRow.CellIterator cellIterator = row.getCellIterator(); for (int colNo = 0; cellIterator.hasNext(); colNo++) { final HtmlTableCell cell = cellIterator.nextCell(); if (rowNo <= rowIndex && rowNo + cell.getRowSpan() > rowIndex) { if (colNo <= columnIndex && colNo + cell.getColumnSpan() > columnIndex) { return cell; } } } } return null; }
@Override public Table getTable(String tableSummaryNameOrId) { HtmlTable table = getHtmlTable(tableSummaryNameOrId); Table result = new Table(); for (int i = 0; i < table.getRowCount(); i++) { Row newRow = new Row(); HtmlTableRow htmlRow = table.getRow(i); CellIterator cellIt = htmlRow.getCellIterator(); while (cellIt.hasNext()) { HtmlTableCell htmlCell = cellIt.nextCell(); newRow.appendCell(new Cell(htmlCell.asText(), htmlCell .getColumnSpan(), htmlCell.getRowSpan())); } result.appendRow(newRow); } return result; }