diff options
author | Javen O'Neal <onealj@apache.org> | 2017-01-19 09:01:39 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2017-01-19 09:01:39 +0000 |
commit | 60f1ed67d45478f5ba2057251fb79e29aa931fd5 (patch) | |
tree | b6ab504f01406004d0a7624ee28695bde34fa8b2 /src | |
parent | 797048ff1ed6ad165f8094f5700e9e73f586a7b9 (diff) | |
download | poi-60f1ed67d45478f5ba2057251fb79e29aa931fd5.tar.gz poi-60f1ed67d45478f5ba2057251fb79e29aa931fd5.zip |
bug 60601: unset hyperlinks after removing them individually from the DOM
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1779437 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index d6fc4353e6..61a56a1024 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -3485,15 +3485,16 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { worksheet.getHyperlinks().setHyperlinkArray(ctHls); } else { - // 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); } + // For some reason, we have to remove the hyperlinks one by one from the CTHyperlinks array + // before unsetting the hyperlink array. + // Resetting the hyperlink array seems to break some XML nodes. + //worksheet.getHyperlinks().setHyperlinkArray(new CTHyperlink[0]); + worksheet.unsetHyperlinks(); } else { // nothing to do } |