--- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (working copy) @@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.Hyperlink; import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellReference; import org.apache.poi.util.Internal; @@ -944,7 +945,7 @@ if(comment != null){ String ref = getReference(); XSSFSheet sh = getSheet(); - sh.getCommentsTable(false).removeComment(ref); + sh.getCommentsTable(false).removeComment(new CellAddress(ref)); sh.getVMLDrawing(false).removeCommentShape(getRowIndex(), getColumnIndex()); } } --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (working copy) @@ -52,6 +52,7 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellRange; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Comment; import org.apache.poi.ss.usermodel.DataValidation; import org.apache.poi.ss.usermodel.DataValidationHelper; import org.apache.poi.ss.usermodel.Footer; @@ -60,6 +61,7 @@ import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.util.AreaReference; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellReference; @@ -656,7 +658,7 @@ return null; } - String ref = new CellReference(row, column).formatAsString(); + CellAddress ref = new CellAddress(row, column); CTComment ctComment = sheetComments.getCTComment(ref); if(ctComment == null) return null; @@ -2613,12 +2615,12 @@ CTCommentList lst = sheetComments.getCTComments().getCommentList(); for (CTComment comment : lst.getCommentArray()) { String strRef = comment.getRef(); - CellReference ref = new CellReference(strRef); + CellAddress ref = new CellAddress(strRef); // is this comment part of the current row? if(ref.getRow() == rownum) { - sheetComments.removeComment(strRef); - vml.removeCommentShape(ref.getRow(), ref.getCol()); + sheetComments.removeComment(ref); + vml.removeCommentShape(ref.getRow(), ref.getColumn()); } } } @@ -3965,4 +3967,8 @@ } return col.getOutlineLevel(); } + + public Map getCellComments(){ + return this.sheetComments.getCellComments(); + } } --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFComment.java (working copy) @@ -23,6 +23,7 @@ import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.Comment; import org.apache.poi.ss.usermodel.RichTextString; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.model.CommentsTable; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; @@ -130,10 +131,10 @@ * @param col the 0-based column of the cell that contains the comment */ public void setColumn(int col) { - String oldRef = _comment.getRef(); + CellAddress oldRef = new CellAddress(_comment.getRef()); - CellReference ref = new CellReference(getRow(), col); - _comment.setRef(ref.formatAsString()); + CellAddress ref = new CellAddress(getRow(), col); + _comment.setRef(ref.toString()); _comments.referenceUpdated(oldRef, _comment); if(_vmlShape != null) { @@ -154,12 +155,11 @@ * @param row the 0-based row of the cell that contains the comment */ public void setRow(int row) { - String oldRef = _comment.getRef(); + CellAddress oldRef = new CellAddress(_comment.getRef()); - String newRef = - (new CellReference(row, getColumn())).formatAsString(); + String newRef = (new CellReference(row, getColumn())).formatAsString(); _comment.setRef(newRef); - _comments.referenceUpdated(oldRef, _comment); + _comments.referenceUpdated(oldRef, _comment); if(_vmlShape != null) { _vmlShape.getClientDataArray(0).setRowArray(0, --- src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java (revision 1702503) +++ src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java (working copy) @@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.XSSFITestDataProvider; import org.apache.poi.xssf.XSSFTestDataSamples; @@ -73,7 +74,7 @@ assertEquals(1, sheetComments.getCTComments().getAuthors().sizeOfAuthorArray()); assertEquals(1, sheetComments.getNumberOfAuthors()); - CTComment ctComment = sheetComments.newComment("A1"); + CTComment ctComment = sheetComments.newComment(CellAddress.A1); CTShape vmlShape = CTShape.Factory.newInstance(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); @@ -88,7 +89,7 @@ public void getSetCol() { CommentsTable sheetComments = new CommentsTable(); XSSFVMLDrawing vml = new XSSFVMLDrawing(); - CTComment ctComment = sheetComments.newComment("A1"); + CTComment ctComment = sheetComments.newComment(CellAddress.A1); CTShape vmlShape = vml.newCommentShape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); @@ -107,7 +108,7 @@ public void getSetRow() { CommentsTable sheetComments = new CommentsTable(); XSSFVMLDrawing vml = new XSSFVMLDrawing(); - CTComment ctComment = sheetComments.newComment("A1"); + CTComment ctComment = sheetComments.newComment(CellAddress.A1); CTShape vmlShape = vml.newCommentShape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); @@ -179,7 +180,7 @@ @Test public void author() { CommentsTable sheetComments = new CommentsTable(); - CTComment ctComment = sheetComments.newComment("A1"); + CTComment ctComment = sheetComments.newComment(CellAddress.A1); assertEquals(1, sheetComments.getNumberOfAuthors()); XSSFComment comment = new XSSFComment(sheetComments, ctComment, null); @@ -243,7 +244,7 @@ vmlShape2.getClientDataArray(0).setAnchorArray(0, position); } - String ref = new CellReference(ca.getRow1(), ca.getCol1()).formatAsString(); + CellAddress ref = new CellAddress(ca.getRow1(), ca.getCol1()); XSSFComment shape2 = new XSSFComment(comments, comments.newComment(ref), vmlShape2); assertEquals(shape1.getAuthor(), shape2.getAuthor()); --- src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (revision 1702503) +++ src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (working copy) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.TreeMap; import org.apache.poi.ddf.EscherRecord; @@ -56,9 +57,11 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellRange; import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Comment; import org.apache.poi.ss.usermodel.DataValidation; import org.apache.poi.ss.usermodel.DataValidationHelper; import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellReference; @@ -2194,6 +2197,33 @@ return null; } + public Map getCellComments() { + HSSFPatriarch patriarch = getDrawingPatriarch(); + if (null == patriarch) { + patriarch = createDrawingPatriarch(); + } + + + Map locations = new TreeMap(); + findCellCommentLocations(patriarch, locations); + return locations; + } + private void findCellCommentLocations(HSSFShapeContainer container, Map locations){ + for (Object object : container.getChildren()) { + HSSFShape shape = (HSSFShape) object; + if (shape instanceof HSSFShapeGroup) { + findCellCommentLocations((HSSFShapeGroup) shape, locations); + continue; + } + if (shape instanceof HSSFComment) { + HSSFComment comment = (HSSFComment) shape; + if (comment.hasPosition()) { + locations.put(new CellAddress(comment.getRow(), comment.getColumn()), comment); + } + } + } + } + public CellRangeAddress getRepeatingRows() { return getRepeatingRowsOrColums(true); --- src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java (working copy) @@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.BuiltinFormats; import org.apache.poi.ss.usermodel.DataFormatter; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellReference; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; @@ -105,7 +106,7 @@ private StringBuffer formula = new StringBuffer(); private StringBuffer headerFooter = new StringBuffer(); - private Queue commentCellRefs; + private Queue commentCellRefs; /** * Accepts objects needed while parsing. @@ -162,9 +163,9 @@ @SuppressWarnings("deprecation") private void init() { if (commentsTable != null) { - commentCellRefs = new LinkedList(); + commentCellRefs = new LinkedList(); for (CTComment comment : commentsTable.getCTComments().getCommentList().getCommentArray()) { - commentCellRefs.add(new CellReference(comment.getRef())); + commentCellRefs.add(new CellAddress(comment.getRef())); } } } @@ -362,7 +363,7 @@ // Do we have a comment for this cell? checkForEmptyCellComments(EmptyCellCommentsCheckType.CELL); - XSSFComment comment = commentsTable != null ? commentsTable.findCellComment(cellRef) : null; + XSSFComment comment = commentsTable != null ? commentsTable.findCellComment(new CellAddress(cellRef)) : null; // Output output.cell(cellRef, thisStr, comment); @@ -443,17 +444,17 @@ } } - CellReference nextCommentCellRef; + CellAddress nextCommentCellRef; do { - CellReference cellRef = new CellReference(this.cellRef); - CellReference peekCellRef = commentCellRefs.peek(); + CellAddress cellRef = new CellAddress(this.cellRef); + CellAddress peekCellRef = commentCellRefs.peek(); if (type == EmptyCellCommentsCheckType.CELL && cellRef.equals(peekCellRef)) { // remove the comment cell ref from the list if we're about to handle it alongside the cell content commentCellRefs.remove(); return; } else { // fill in any gaps if there are empty cells with comment mixed in with non-empty cells - int comparison = cellRefComparator.compare(peekCellRef, cellRef); + int comparison = peekCellRef.compareTo(cellRef); if (comparison > 0 && type == EmptyCellCommentsCheckType.END_OF_ROW && peekCellRef.getRow() <= rowNum) { nextCommentCellRef = commentCellRefs.remove(); outputEmptyCellComment(nextCommentCellRef); @@ -472,10 +473,9 @@ /** * Output an empty-cell comment. */ - private void outputEmptyCellComment(CellReference cellRef) { - String cellRefString = cellRef.formatAsString(); - XSSFComment comment = commentsTable.findCellComment(cellRefString); - output.cell(cellRefString, null, comment); + private void outputEmptyCellComment(CellAddress cellRef) { + XSSFComment comment = commentsTable.findCellComment(cellRef); + output.cell(cellRef.toString(), null, comment); } private enum EmptyCellCommentsCheckType { --- src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java (working copy) @@ -21,10 +21,14 @@ import java.io.OutputStream; import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackageRelationship; +import org.apache.poi.ss.usermodel.Comment; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.xssf.usermodel.XSSFComment; import org.apache.xmlbeans.XmlException; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; @@ -39,7 +43,7 @@ * to search, so we wrap things with our own * map for fast lookup. */ - private Map commentRefs; + private Map commentRefs; public CommentsTable() { super(); @@ -79,10 +83,10 @@ * Called after the reference is updated, so that * we can reflect that in our cache */ - public void referenceUpdated(String oldReference, CTComment comment) { + public void referenceUpdated(CellAddress oldReference, CTComment comment) { if(commentRefs != null) { commentRefs.remove(oldReference); - commentRefs.put(comment.getRef(), comment); + commentRefs.put(new CellAddress(comment.getRef()), comment); } } @@ -109,23 +113,40 @@ return addNewAuthor(author); } - public XSSFComment findCellComment(String cellRef) { + public XSSFComment findCellComment(CellAddress cellRef) { CTComment ct = getCTComment(cellRef); return ct == null ? null : new XSSFComment(this, ct, null); } @SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support - public CTComment getCTComment(String cellRef) { + public CTComment getCTComment(CellAddress cellRef) { + // Create the cache if needed + prepareCTCommentCache(); + + // Return the comment, or null if not known + return commentRefs.get(cellRef); + } + + public Map getCellComments(){ + prepareCTCommentCache(); + final TreeMap map = new TreeMap(); + + for(final Entry e: commentRefs.entrySet()){ + map.put(e.getKey(), new XSSFComment(this, e.getValue(), null)); + } + + return map; + } + + @SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support + private void prepareCTCommentCache() { // Create the cache if needed if(commentRefs == null) { - commentRefs = new HashMap(); + commentRefs = new HashMap(); for (CTComment comment : comments.getCommentList().getCommentArray()) { - commentRefs.put(comment.getRef(), comment); + commentRefs.put(new CellAddress(comment.getRef()), comment); } } - - // Return the comment, or null if not known - return commentRefs.get(cellRef); } /** @@ -135,27 +156,28 @@ */ @Deprecated public CTComment newComment() { - return newComment("A1"); + return newComment(CellAddress.A1); } - public CTComment newComment(String ref) { + public CTComment newComment(CellAddress ref) { CTComment ct = comments.getCommentList().addNewComment(); - ct.setRef(ref); + ct.setRef(ref.toString()); ct.setAuthorId(0); if(commentRefs != null) { - commentRefs.put(ct.getRef(), ct); + commentRefs.put(ref, ct); } return ct; } - public boolean removeComment(String cellRef) { + public boolean removeComment(CellAddress cellRef) { + final String stringRef = cellRef.toString(); CTCommentList lst = comments.getCommentList(); if(lst != null) { CTComment[] commentArray = lst.getCommentArray(); for (int i = 0; i < commentArray.length; i++) { CTComment comment = commentArray[i]; - if (cellRef.equals(comment.getRef())) { + if (stringRef.equals(comment.getRef())) { lst.removeComment(i); if(commentRefs != null) { --- src/java/org/apache/poi/ss/usermodel/Sheet.java (revision 1702503) +++ src/java/org/apache/poi/ss/usermodel/Sheet.java (working copy) @@ -19,8 +19,10 @@ import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.poi.hssf.util.PaneInformation; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellRangeAddress; /** @@ -1067,4 +1069,11 @@ * you take it out of them. */ int getColumnOutlineLevel(int columnIndex); + + + /** + * Returns all cell comments of this sheet. + * @return A map of CellAdress objects and their associated comments. + */ + Map getCellComments(); } --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java (working copy) @@ -33,6 +33,7 @@ import org.apache.poi.openxml4j.opc.TargetMode; import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellReference; import org.apache.poi.util.Internal; import org.apache.poi.util.Units; @@ -312,7 +313,7 @@ ca.getRow2() + ", " + dy2Pixels; vmlShape.getClientDataArray(0).setAnchorArray(0, position); } - String ref = new CellReference(ca.getRow1(), ca.getCol1()).formatAsString(); + CellAddress ref = new CellAddress(ca.getRow1(), ca.getCol1()); if(comments.findCellComment(ref) != null) { throw new IllegalArgumentException("Multiple cell comments in one cell are not allowed, cell: " + ref); --- src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java (revision 1702503) +++ src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java (working copy) @@ -34,6 +34,7 @@ import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.xssf.XSSFTestDataSamples; import org.apache.poi.xssf.usermodel.XSSFClientAnchor; import org.apache.poi.xssf.usermodel.XSSFRichTextString; @@ -86,9 +87,9 @@ comment1.setText(ctrst1); // test finding the right comment for a cell - assertSame(comment0, sheetComments.getCTComment("A1")); - assertSame(comment1, sheetComments.getCTComment("A2")); - assertNull(sheetComments.getCTComment("A3")); + assertSame(comment0, sheetComments.getCTComment(new CellAddress("A1"))); + assertSame(comment1, sheetComments.getCTComment(new CellAddress("A2"))); + assertNull(sheetComments.getCTComment(new CellAddress("A3"))); } @@ -210,33 +211,37 @@ @Test public void removeComment() throws Exception { + final CellAddress adra1 = new CellAddress("A1"); + final CellAddress adra2 = new CellAddress("A2"); + final CellAddress adra3 = new CellAddress("A3"); + CommentsTable sheetComments = new CommentsTable(); - CTComment a1 = sheetComments.newComment("A1"); - CTComment a2 = sheetComments.newComment("A2"); - CTComment a3 = sheetComments.newComment("A3"); + CTComment a1 = sheetComments.newComment(adra1); + CTComment a2 = sheetComments.newComment(adra2); + CTComment a3 = sheetComments.newComment(adra3); - assertSame(a1, sheetComments.getCTComment("A1")); - assertSame(a2, sheetComments.getCTComment("A2")); - assertSame(a3, sheetComments.getCTComment("A3")); + assertSame(a1, sheetComments.getCTComment(adra1)); + assertSame(a2, sheetComments.getCTComment(adra2)); + assertSame(a3, sheetComments.getCTComment(adra3)); assertEquals(3, sheetComments.getNumberOfComments()); - assertTrue(sheetComments.removeComment("A1")); + assertTrue(sheetComments.removeComment(adra1)); assertEquals(2, sheetComments.getNumberOfComments()); - assertNull(sheetComments.getCTComment("A1")); - assertSame(a2, sheetComments.getCTComment("A2")); - assertSame(a3, sheetComments.getCTComment("A3")); + assertNull(sheetComments.getCTComment(adra1)); + assertSame(a2, sheetComments.getCTComment(adra2)); + assertSame(a3, sheetComments.getCTComment(adra3)); - assertTrue(sheetComments.removeComment("A2")); + assertTrue(sheetComments.removeComment(adra2)); assertEquals(1, sheetComments.getNumberOfComments()); - assertNull(sheetComments.getCTComment("A1")); - assertNull(sheetComments.getCTComment("A2")); - assertSame(a3, sheetComments.getCTComment("A3")); + assertNull(sheetComments.getCTComment(adra1)); + assertNull(sheetComments.getCTComment(adra2)); + assertSame(a3, sheetComments.getCTComment(adra3)); - assertTrue(sheetComments.removeComment("A3")); + assertTrue(sheetComments.removeComment(adra3)); assertEquals(0, sheetComments.getNumberOfComments()); - assertNull(sheetComments.getCTComment("A1")); - assertNull(sheetComments.getCTComment("A2")); - assertNull(sheetComments.getCTComment("A3")); + assertNull(sheetComments.getCTComment(adra1)); + assertNull(sheetComments.getCTComment(adra2)); + assertNull(sheetComments.getCTComment(adra3)); } @Test --- src/java/org/apache/poi/ss/util/CellAddress.java (nonexistent) +++ src/java/org/apache/poi/ss/util/CellAddress.java (working copy) @@ -0,0 +1,105 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.ss.util; + +import java.util.Locale; + +/** + * This class is a container for POI usermodel row=0 column=0 cell references. + * It is barely a container for these two coordinates. The implementation + * of the Comparable interface sorts by "natural" order top left to bottom right. + */ +public class CellAddress implements Comparable{ + /** A constant for references to the first cell in a sheet. */ + public static final CellAddress A1 = new CellAddress(0, 0); + + private final int _row; + private final int _col; + + /** + * Create a new CellAddress object. + * + * @param row Row index (first row is 0) + * @param column Column index (first column is 0) + */ + public CellAddress(int row, int column) { + super(); + this._row = row; + this._col = column; + } + + public int getRow() { + return _row; + } + + public int getColumn() { + return _col; + } + + public int compareTo(CellAddress o) { + int r = this._row-o._row; + if (r!=0) return r; + + r = this._col-o._col; + if (r!=0) return r; + + return 0; + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if(!(o instanceof CellAddress)) { + return false; + } + + CellAddress cr = (CellAddress) o; + return _row == cr._row + && _col == cr._col + ; + } + + public int hashCode() { + return this._row + this._col<<16; + } + + public CellAddress(String reference) { + int length = reference.length(); + + int loc = 0; + // step over column name chars until first digit for row number. + for (; loc < length; loc++) { + char ch = reference.charAt(loc); + if (Character.isDigit(ch)) { + break; + } + } + + String sCol = reference.substring(0,loc).toUpperCase(Locale.ROOT); + String sRow = reference.substring(loc); + + + this._row = Integer.parseInt(sRow)-1; + this._col = CellReference.convertColStringToIndex(sCol); + } + + public String toString() { + return CellReference.convertNumToColString(this._col)+(this._row+1); + } +} --- src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (revision 1702503) +++ src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (working copy) @@ -41,6 +41,7 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.SheetConditionalFormatting; import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.SheetUtil; import org.apache.poi.xssf.usermodel.XSSFDataValidation; @@ -1539,4 +1540,8 @@ public int getColumnOutlineLevel(int columnIndex) { return _sh.getColumnOutlineLevel(columnIndex); } + + public Map getCellComments() { + return _sh.getCellComments(); + } }