fix broken test case

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-08-09 22:39:27 +00:00
parent 0b89ad3f77
commit 5e15f7bf77
1 changed files with 8 additions and 2 deletions

View File

@ -341,8 +341,11 @@ public class XSSFHyperlink implements Hyperlink {
*/ */
@Override @Override
public void setFirstColumn(int col) { public void setFirstColumn(int col) {
int lastColumn = getLastColumn();
if (col > lastColumn) lastColumn = col;
String firstCellRef = CellReference.convertNumToColString(col) + (getFirstRow() + 1); 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 @Override
public void setFirstRow(int row) { public void setFirstRow(int row) {
int lastRow = getLastRow();
if (row > lastRow) lastRow = row;
String firstCellRef = CellReference.convertNumToColString(getFirstColumn()) + (row + 1); String firstCellRef = CellReference.convertNumToColString(getFirstColumn()) + (row + 1);
setCellRange(firstCellRef + ":" + buildLastCellReference().formatAsString()); String lastCellRef = CellReference.convertNumToColString(getLastColumn()) + (lastRow + 1);
setCellRange(firstCellRef + ":" + lastCellRef);
} }
/** /**