/** * Find a shape with ClientData of type "NOTE" and the specified row and column * * @return the comment shape or <code>null</code> */ public CTShape findCommentShape(int row, int col){ for(XmlObject itm : _items){ if(itm instanceof CTShape){ CTShape sh = (CTShape)itm; if(sh.sizeOfClientDataArray() > 0){ CTClientData cldata = sh.getClientDataArray(0); if(cldata.getObjectType() == STObjectType.NOTE){ int crow = cldata.getRowArray(0).intValue(); int ccol = cldata.getColumnArray(0).intValue(); if(crow == row && ccol == col) { return sh; } } } } } return null; }
/** * Creates a new XSSFComment, associated with a given * low level comment object. */ public XSSFComment(CommentsTable comments, CTComment comment, CTShape vmlShape) { _comment = comment; _comments = comments; _vmlShape = vmlShape; // we potentially need to adjust the column/row information in the shape // the same way as we do in setRow()/setColumn() if(comment != null && vmlShape != null && vmlShape.sizeOfClientDataArray() > 0) { CellReference ref = new CellReference(comment.getRef()); CTClientData clientData = vmlShape.getClientDataArray(0); clientData.setRowArray(0, new BigInteger(String.valueOf(ref.getRow()))); clientData.setColumnArray(0, new BigInteger(String.valueOf(ref.getCol()))); avoidXmlbeansCorruptPointer(vmlShape); } }
/** * Find a shape with ClientData of type "NOTE" and the specified row and column * * @return the comment shape or <code>null</code> */ public CTShape findCommentShape(int row, int col){ for(XmlObject itm : _items){ if(itm instanceof CTShape){ CTShape sh = (CTShape)itm; if(sh.sizeOfClientDataArray() > 0){ CTClientData cldata = sh.getClientDataArray(0); if(cldata.getObjectType() == STObjectType.NOTE){ int crow = cldata.getRowArray(0).intValue(); int ccol = cldata.getColumnArray(0).intValue(); if(crow == row && ccol == col) { return sh; } } } } } return null; }
/** * Creates a new XSSFComment, associated with a given * low level comment object. */ public XSSFComment(CommentsTable comments, CTComment comment, CTShape vmlShape) { _comment = comment; _comments = comments; _vmlShape = vmlShape; // we potentially need to adjust the column/row information in the shape // the same way as we do in setRow()/setColumn() if(comment != null && vmlShape != null && vmlShape.sizeOfClientDataArray() > 0) { CellReference ref = new CellReference(comment.getRef()); CTClientData clientData = vmlShape.getClientDataArray(0); clientData.setRowArray(0, new BigInteger(String.valueOf(ref.getRow()))); clientData.setColumnArray(0, new BigInteger(String.valueOf(ref.getCol()))); avoidXmlbeansCorruptPointer(vmlShape); } }