You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2017/01/19 08:09:11 UTC

svn commit: r1779429 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Author: onealj
Date: Thu Jan 19 08:09:11 2017
New Revision: 1779429

URL: http://svn.apache.org/viewvc?rev=1779429&view=rev
Log:
bug 60601: hyperlinks have to be removed one by one to avoid other errors

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1779429&r1=1779428&r2=1779429&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Thu Jan 19 08:09:11 2017
@@ -3485,7 +3485,18 @@ public class XSSFSheet extends POIXMLDoc
             worksheet.getHyperlinks().setHyperlinkArray(ctHls);
         }
         else {
-            worksheet.unsetHyperlinks();
+            // For some reason, we have to remove the hyperlinks one by one from the CTHyperlinks array
+            // rather than unsetting or resetting the hyperlink array.
+            //worksheet.getHyperlinks().setHyperlinkArray(new CTHyperlink[0]);
+            //worksheet.unsetHyperlinks();
+            if (worksheet.getHyperlinks() != null) {
+                final int count = worksheet.getHyperlinks().sizeOfHyperlinkArray();
+                for (int i=count-1; i>=0; i--) {
+                    worksheet.getHyperlinks().removeHyperlink(i);
+                }
+            } else {
+                // nothing to do
+            }
         }
 
         int minCell=Integer.MAX_VALUE, maxCell=Integer.MIN_VALUE;



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