@Override public int getColumn() { return cellAddress.getColumn(); }
/** * @return the 0-based column of the cell that the comment is associated with. */ @Override public int getColumn() { return getAddress().getColumn(); }
/** * Create a new CellAddress object * * @param address a CellAddress */ public CellAddress(CellAddress address) { this(address.getRow(), address.getColumn()); }
/** * Determines if the given {@link CellAddress} lies within the bounds * of this range. * <p>NOTE: It is up to the caller to ensure the reference is * for the correct sheet, since this instance doesn't have a sheet reference. * * @param ref the CellAddress to check * @return True if the reference lies within the bounds, false otherwise. * @see #intersects(CellRangeAddressBase) for checking if two ranges overlap */ public boolean isInRange(CellAddress ref) { return isInRange(ref.getRow(), ref.getColumn()); }
/** * Returns cell comment for the specified row and column * * @return cell comment or <code>null</code> if not found */ @Override public HSSFComment getCellComment(CellAddress ref) { return findCellComment(ref.getRow(), ref.getColumn()); }
/** * Get a Hyperlink in this sheet located in a cell specified by {code addr} * * @param addr The address of the cell containing the hyperlink * @return hyperlink if there is a hyperlink anchored at {@code addr}; otherwise returns {@code null} * @since POI 3.15 beta 3 */ @Override public HSSFHyperlink getHyperlink(CellAddress addr) { return getHyperlink(addr.getRow(), addr.getColumn()); }
private void checkMissedComments(int currentRow, int colNum) { if (comments == null) { return; } Queue<CellAddress> queue = comments.getAddresses(); while (queue.size() > 0) { CellAddress cellAddress = queue.peek(); if (cellAddress.getRow() == currentRow && cellAddress.getColumn() < colNum) { cellAddress = queue.remove(); dumpEmptyCellComment(cellAddress, comments.get(cellAddress)); } else if (cellAddress.getRow() == currentRow && cellAddress.getColumn() == colNum) { queue.remove(); return; } else if (cellAddress.getRow() == currentRow && cellAddress.getColumn() > colNum) { return; } else if (cellAddress.getRow() > currentRow) { return; } } }
/** * * @param cellAddress cell address to find * @return null if not a hyperlink */ public List<XSSFHyperlinkRecord> findHyperlinkRecord(CellAddress cellAddress) { List<XSSFHyperlinkRecord> overlapping = null; CellRangeAddress targetCellRangeAddress = new CellRangeAddress(cellAddress.getRow(), cellAddress.getRow(), cellAddress.getColumn(), cellAddress.getColumn()); for (XSSFHyperlinkRecord record : hyperlinkRecords) { if (CellRangeUtil.intersect(targetCellRangeAddress, record.getCellRangeAddress()) != CellRangeUtil.NO_INTERSECTION) { if (overlapping == null) { overlapping = new ArrayList<>(); } overlapping.add(record); } } return overlapping; }
/** * {@inheritDoc} */ @Override public void setActiveCell(CellAddress address) { int row = address.getRow(); short col = (short) address.getColumn(); _sheet.setActiveCellRow(row); _sheet.setActiveCellCol(col); } }
@Override public void setAddress(CellAddress address) { setRow(address.getRow()); setColumn(address.getColumn()); }
/** * Applies the drawn borders to a Sheet. The borders that are applied are * the ones that have been drawn by the {@link #drawBorders} and * {@link #drawBorderColors} methods. * * @param sheet * - {@link Sheet} on which to apply borders */ public void applyBorders(Sheet sheet) { Workbook wb = sheet.getWorkbook(); for (Map.Entry<CellAddress, Map<String, Object>> entry : _propertyTemplate .entrySet()) { CellAddress cellAddress = entry.getKey(); if (cellAddress.getRow() < wb.getSpreadsheetVersion().getMaxRows() && cellAddress.getColumn() < wb.getSpreadsheetVersion() .getMaxColumns()) { Map<String, Object> properties = entry.getValue(); Row row = CellUtil.getRow(cellAddress.getRow(), sheet); Cell cell = CellUtil.getCell(row, cellAddress.getColumn()); CellUtil.setCellStyleProperties(cell, properties); } } }
@Override public void setAddress(CellAddress address) { CellAddress oldRef = new CellAddress(_comment.getRef()); if (address.equals(oldRef)) { // nothing to do return; } _comment.setRef(address.formatAsString()); _comments.referenceUpdated(oldRef, _comment); if (_vmlShape != null) { CTClientData clientData = _vmlShape.getClientDataArray(0); clientData.setRowArray(0, new BigInteger(String.valueOf(address.getRow()))); clientData.setColumnArray(0, new BigInteger(String.valueOf(address.getColumn()))); avoidXmlbeansCorruptPointer(_vmlShape); } }
vml.removeCommentShape(ref.getRow(), ref.getColumn());
/** * Return cell comment at row, column, if one exists. Otherwise returns null. * * @param address the location of the cell comment * @return the cell comment, if one exists. Otherwise return null. */ @Override public XSSFComment getCellComment(CellAddress address) { if (sheetComments == null) { return null; } final int row = address.getRow(); final int column = address.getColumn(); CellAddress ref = new CellAddress(row, column); CTComment ctComment = sheetComments.getCTComment(ref); if(ctComment == null) { return null; } XSSFVMLDrawing vml = getVMLDrawing(false); return new XSSFComment(sheetComments, ctComment, vml == null ? null : vml.findCommentShape(row, column)); }
/** * @return the 0-based column of the cell that the comment is associated with. */ @Override public int getColumn() { return getAddress().getColumn(); }
/** * Create a new CellAddress object * * @param address a CellAddress */ public CellAddress(CellAddress address) { this(address.getRow(), address.getColumn()); }
/** * Determines if the given {@link CellAddress} lies within the bounds * of this range. * <p>NOTE: It is up to the caller to ensure the reference is * for the correct sheet, since this instance doesn't have a sheet reference. * * @param ref the CellAddress to check * @return True if the reference lies within the bounds, false otherwise. * @see #intersects(CellRangeAddressBase) for checking if two ranges overlap */ public boolean isInRange(CellAddress ref) { return isInRange(ref.getRow(), ref.getColumn()); }
/** * Returns cell comment for the specified row and column * * @return cell comment or <code>null</code> if not found */ @Override public HSSFComment getCellComment(CellAddress ref) { return findCellComment(ref.getRow(), ref.getColumn()); }
@Override public void setAddress(CellAddress address) { setRow(address.getRow()); setColumn(address.getColumn()); }