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/10 14:10:59 UTC

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

Author: fanningpj
Date: Tue Aug 10 14:10:59 2021
New Revision: 1892178

URL: http://svn.apache.org/viewvc?rev=1892178&view=rev
Log:
add support for reading hyperlinks that have cell refs that are area references (very limited update or write support as yet)

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=1892178&r1=1892177&r2=1892178&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 Tue Aug 10 14:10:59 2021
@@ -355,8 +355,11 @@ public class XSSFHyperlink implements Hy
      */
     @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 Hy
      */
     @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) {



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