aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-08-10 14:10:59 +0000
committerPJ Fanning <fanningpj@apache.org>2021-08-10 14:10:59 +0000
commitdf9bc05a945d9f164ec9e0673dde6b31ecb0e48c (patch)
treeb90480961c58d78c31970de2cd335ff917095a2e /poi-ooxml
parent85fb57626eb2782a9a1c4c71eb110c1189dde29a (diff)
downloadpoi-df9bc05a945d9f164ec9e0673dde6b31ecb0e48c.tar.gz
poi-df9bc05a945d9f164ec9e0673dde6b31ecb0e48c.zip
add support for reading hyperlinks that have cell refs that are area references (very limited update or write support as yet)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892178 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
index 4804116312..58ccde183e 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
@@ -355,8 +355,11 @@ public class XSSFHyperlink implements Hyperlink {
*/
@Override
public void setLastColumn(int col) {
+ int firstColumn = getFirstColumn();
+ if (col < firstColumn) firstColumn = col;
+ String firstCellRef = CellReference.convertNumToColString(firstColumn) + (getFirstRow() + 1);
String lastCellRef = CellReference.convertNumToColString(col) + (getLastRow() + 1);
- setCellRange(buildFirstCellReference().formatAsString() + ":" + lastCellRef);
+ setCellRange(firstCellRef + ":" + lastCellRef);
}
/**
@@ -380,8 +383,11 @@ public class XSSFHyperlink implements Hyperlink {
*/
@Override
public void setLastRow(int row) {
+ int firstRow = getFirstRow();
+ if (row < firstRow) firstRow = row;
+ String firstCellRef = CellReference.convertNumToColString(getFirstColumn()) + (firstRow + 1);
String lastCellRef = CellReference.convertNumToColString(getLastColumn()) + (row + 1);
- setCellRange(buildFirstCellReference().formatAsString() + ":" + lastCellRef);
+ setCellRange(firstCellRef + ":" + lastCellRef);
}
private void setCellRange(String range) {