/** * 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)); }
@Override public final String toString() { CellAddress crA = new CellAddress(_firstRow, _firstCol); CellAddress crB = new CellAddress(_lastRow, _lastCol); return getClass().getName() + " [" + crA.formatAsString() + ":" + crB.formatAsString() +"]"; }
if (type == EmptyCellCommentsCheckType.END_OF_ROW) { while (!commentCellRefs.isEmpty()) { if (commentCellRefs.peek().getRow() == rowNum) { outputEmptyCellComment(commentCellRefs.remove()); } else { CellAddress cellRef = new CellAddress(this.cellRef); CellAddress peekCellRef = commentCellRefs.peek(); if (type == EmptyCellCommentsCheckType.CELL && cellRef.equals(peekCellRef)) { } else { int comparison = peekCellRef.compareTo(cellRef); if (comparison > 0 && type == EmptyCellCommentsCheckType.END_OF_ROW && peekCellRef.getRow() <= rowNum) { nextCommentCellRef = commentCellRefs.remove(); outputEmptyCellComment(nextCommentCellRef); } else if (comparison < 0 && type == EmptyCellCommentsCheckType.CELL && peekCellRef.getRow() <= rowNum) { nextCommentCellRef = commentCellRefs.remove(); outputEmptyCellComment(nextCommentCellRef);
@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); } }
/** * {@inheritDoc} */ @Override public CellAddress getAddress() { return new CellAddress(this); }
@Override public String toString() { return formatAsString(); }
@Override public void cell(String cellReference, String formattedValue, XSSFComment comment) { // create empty column, if needed CellAddress currentCellAddress = new CellAddress(cellReference); for (int i=this.currentColumn;i<currentCellAddress.getColumn();i++) { this.spreadSheetCellDAOCurrentRow.add(null); this.currentColumn++; } // add column SpreadSheetCellDAO currentDAO = null; if (comment!=null) { currentDAO = new SpreadSheetCellDAO(formattedValue,comment.getString().getString(), "", cellReference,this.sheetName); } else { currentDAO = new SpreadSheetCellDAO(formattedValue,"", "", cellReference,this.sheetName); } this.currentColumn++; this.spreadSheetCellDAOCurrentRow.add(currentDAO); } @Override
@Override public int getColumn() { return cellAddress.getColumn(); }
@Override public int getRow() { return cellAddress.getRow(); }
/** * {@inheritDoc} */ @Override public CellAddress getAddress() { return new CellAddress(this); }
@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); } }
private void dumpEmptyCellComment(CellAddress cellAddress, XSSFBComment comment) { handler.cell(cellAddress.formatAsString(), null, comment); }
/** * @return the 0-based column of the cell that the comment is associated with. */ @Override public int getColumn() { return getAddress().getColumn(); }
/** * @return the 0-based row index of the cell that the comment is associated with. */ @Override public int getRow() { return getAddress().getRow(); }
/** * 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()); }
for (CTComment comment : lst.getCommentArray()) { String strRef = comment.getRef(); CellAddress ref = new CellAddress(strRef); if(ref.getRow() == rownum) { sheetComments.removeComment(ref); vml.removeCommentShape(ref.getRow(), ref.getColumn());
/** * {@inheritDoc} */ @Override public CellAddress getAddress() { return new CellAddress(this); }
private void handleCellValue(String formattedValue) { CellAddress cellAddress = new CellAddress(currentRow, cellBuffer.getColNum()); XSSFBComment comment = null; if (comments != null) { comment = comments.get(cellAddress); } handler.cell(cellAddress.formatAsString(), formattedValue, comment); }