bug 59443: use Comment.setAddress when changing both row and column of cell comment address

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742880 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-05-09 05:25:29 +00:00
parent 70459401a3
commit 191726ee7b
3 changed files with 7 additions and 4 deletions

View File

@ -17,6 +17,7 @@
package org.apache.poi.xssf.usermodel.examples;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.IOException;
@ -68,8 +69,7 @@ public class CellComments {
comment2.setString(str2);
comment2.setAuthor("Apache POI");
comment2.setColumn(2);
comment2.setRow(2);
comment2.setAddress(new CellAddress("C3"));
String fname = "comments.xlsx";
FileOutputStream out = new FileOutputStream(fname);

View 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
*/

View File

@ -1039,8 +1039,7 @@ public final class XSSFCell implements Cell {
return;
}
comment.setRow(getRowIndex());
comment.setColumn(getColumnIndex());
comment.setAddress(getRowIndex(), getColumnIndex());
}
/**