https://bz.apache.org/bugzilla/show_bug.cgi?id=60601
Bug ID: 60601 Summary: Hyperlinks in original worksheet are not removed if there are no more hyperlinks on write. Product: POI Version: 3.16-dev Hardware: All OS: All Status: NEW Severity: normal Priority: P2 Component: XSSF Assignee: dev@poi.apache.org Reporter: p...@uniquare.com Target Milestone: --- If a workbook is loaded that contains hyperlinks, and all hyperlinks are removed via cell.removeHyperlink(), the written workbook still contains all hyperlinks. The following change in XSSFSheet fixes this issue: // Now re-generate our CTHyperlinks, if needed if(hyperlinks.size() > 0) { if(worksheet.getHyperlinks() == null) { worksheet.addNewHyperlinks(); } CTHyperlink[] ctHls = new CTHyperlink[hyperlinks.size()]; for(int i=0; i<ctHls.length; i++) { // If our sheet has hyperlinks, have them add // any relationships that they might need XSSFHyperlink hyperlink = hyperlinks.get(i); hyperlink.generateRelationIfNeeded(getPackagePart()); // Now grab their underling object ctHls[i] = hyperlink.getCTHyperlink(); } worksheet.getHyperlinks().setHyperlinkArray(ctHls); } else // line added worksheet.unsetHyperlinks(); // line added -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org