summaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-08-09 22:39:27 +0000
committerPJ Fanning <fanningpj@apache.org>2021-08-09 22:39:27 +0000
commit5e15f7bf773afaf0a4b9d2ef4f3031b06d671ea6 (patch)
tree926e1f62d4bad3ee6ab5a837e180ee4813ad0ea3 /poi-ooxml
parent0b89ad3f77623c9b335c5fac96e7001d6e20a953 (diff)
downloadpoi-5e15f7bf773afaf0a4b9d2ef4f3031b06d671ea6.tar.gz
poi-5e15f7bf773afaf0a4b9d2ef4f3031b06d671ea6.zip
fix broken test case
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892144 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 8913859a2f..4804116312 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
@@ -341,8 +341,11 @@ public class XSSFHyperlink implements Hyperlink {
*/
@Override
public void setFirstColumn(int col) {
+ int lastColumn = getLastColumn();
+ if (col > lastColumn) lastColumn = col;
String firstCellRef = CellReference.convertNumToColString(col) + (getFirstRow() + 1);
- setCellRange(firstCellRef + ":" + buildLastCellReference().formatAsString());
+ String lastCellRef = CellReference.convertNumToColString(lastColumn) + (getLastRow() + 1);
+ setCellRange(firstCellRef + ":" + lastCellRef);
}
/**
@@ -363,8 +366,11 @@ public class XSSFHyperlink implements Hyperlink {
*/
@Override
public void setFirstRow(int row) {
+ int lastRow = getLastRow();
+ if (row > lastRow) lastRow = row;
String firstCellRef = CellReference.convertNumToColString(getFirstColumn()) + (row + 1);
- setCellRange(firstCellRef + ":" + buildLastCellReference().formatAsString());
+ String lastCellRef = CellReference.convertNumToColString(getLastColumn()) + (lastRow + 1);
+ setCellRange(firstCellRef + ":" + lastCellRef);
}
/**