]> source.dussan.org Git - poi.git/commitdiff
bug 59443: use Comment.setAddress when changing both row and column of cell comment...
authorJaven O'Neal <onealj@apache.org>
Mon, 9 May 2016 05:25:29 +0000 (05:25 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 9 May 2016 05:25:29 +0000 (05:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742880 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/xssf/usermodel/examples/CellComments.java
src/java/org/apache/poi/ss/usermodel/Comment.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java

index 252d7488a8759f88365c77d3c869cfe0b9690394..a94e58a34275866368893bb8bf37b0dea3ec63fe 100644 (file)
@@ -17,6 +17,7 @@
 package org.apache.poi.xssf.usermodel.examples;\r
 \r
 import org.apache.poi.ss.usermodel.*;\r
+import org.apache.poi.ss.util.CellAddress;\r
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;\r
 \r
 import java.io.IOException;\r
@@ -68,8 +69,7 @@ public class CellComments {
 \r
         comment2.setString(str2);\r
         comment2.setAuthor("Apache POI");\r
-        comment2.setColumn(2);\r
-        comment2.setRow(2);\r
+        comment2.setAddress(new CellAddress("C3"));\r
 \r
         String fname = "comments.xlsx";\r
         FileOutputStream out = new FileOutputStream(fname);\r
index 1fbda29fac66531df795685bb3f607a029da5f8d..8f5396ca6b1d289540acdeaf15a801e09fc6a1d4 100644 (file)
@@ -113,6 +113,10 @@ public interface Comment {
 
     /**
      * Return defines position of this anchor in the sheet.
+     * The anchor is the yellow box/balloon that is rendered on top of the sheets
+     * when the comment is visible.
+     * 
+     * To associate a comment with a different cell, use {@link #setAddress}.
      *
      * @return defines position of this anchor in the sheet
      */
index 1053c834deac1c39be1e2cdc97e0cb8d7d59bd54..29aaa867e251b21f810266750ce61eebbb2c1b91 100644 (file)
@@ -1039,8 +1039,7 @@ public final class XSSFCell implements Cell {
             return;
         }
 
-        comment.setRow(getRowIndex());
-        comment.setColumn(getColumnIndex());
+        comment.setAddress(getRowIndex(), getColumnIndex());
     }
 
     /**