@Override public ClientAnchor getClientAnchor() { if(_vmlShape == null) { return null; } String position = _vmlShape.getClientDataArray(0).getAnchorArray(0); int[] pos = new int[8]; int i = 0; for (String s : position.split(",")) { pos[i++] = Integer.parseInt(s.trim()); } return new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]); }
/** * 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); } }
@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); } }
String position = ca.getCol1() + ", " + dx1Pixels + ", " + ca.getRow1() + ", " + dy1Pixels + ", " + ca .getCol2() + ", " + dx2Pixels + ", " + ca.getRow2() + ", " + dy2Pixels; vmlShape.getClientDataArray(0).setAnchorArray(0, position);
@Override public ClientAnchor getClientAnchor() { if(_vmlShape == null) { return null; } String position = _vmlShape.getClientDataArray(0).getAnchorArray(0); int[] pos = new int[8]; int i = 0; for (String s : position.split(",")) { pos[i++] = Integer.parseInt(s.trim()); } return new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]); }
/** * 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); } }
@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); } }
String position = ca.getCol1() + ", " + dx1Pixels + ", " + ca.getRow1() + ", " + dy1Pixels + ", " + ca .getCol2() + ", " + dx2Pixels + ", " + ca.getRow2() + ", " + dy2Pixels; vmlShape.getClientDataArray(0).setAnchorArray(0, position);