You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/08/09 22:39:27 UTC

svn commit: r1892144 - /poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java

Author: fanningpj
Date: Mon Aug  9 22:39:27 2021
New Revision: 1892144

URL: http://svn.apache.org/viewvc?rev=1892144&view=rev
Log:
fix broken test case

Modified:
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java?rev=1892144&r1=1892143&r2=1892144&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java Mon Aug  9 22:39:27 2021
@@ -341,8 +341,11 @@ public class XSSFHyperlink implements Hy
      */
     @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 Hy
      */
     @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);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org