Browse Source

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
tags/REL_3_15_BETA2
Javen O'Neal 8 years ago
parent
commit
cb23ca952b

+ 2
- 2
src/examples/src/org/apache/poi/xssf/usermodel/examples/CellComments.java 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);

+ 4
- 0
src/java/org/apache/poi/ss/usermodel/Comment.java 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
*/

+ 1
- 2
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java View File

@@ -1039,8 +1039,7 @@ public final class XSSFCell implements Cell {
return;
}

comment.setRow(getRowIndex());
comment.setColumn(getColumnIndex());
comment.setAddress(getRowIndex(), getColumnIndex());
}

/**

Loading…
Cancel
Save