Bug 58572 - Make XSSFSheet.getHyperlinkList() and XSSFSheet.getHyperlink(row, col) available in Sheet interface
Summary: Make XSSFSheet.getHyperlinkList() and XSSFSheet.getHyperlink(row, col) availa...
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.14-dev
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 58348
  Show dependency tree
Reported: 2015-11-02 08:28 UTC by Javen O'Neal
Modified: 2015-11-02 13:06 UTC (History)
1 user (show)

changes to make hyperlinks accessible via HSSFSheet and SXSSFSheet (14.26 KB, patch)
2015-11-02 09:41 UTC, Javen O'Neal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Javen O'Neal 2015-11-02 08:28:53 UTC
XSSFSheet.getHyperlinkList and XSSFSheet.getHyperlink are currently only available in the XSSFSheet implementation, and aren't available in HSSFSheets. Currently the only way to get a hyperlink from an HSSFWorkbook is to use HSSFCell.getHyperlink(). To get all hyperlinks in a workbook, this requires iterating over all cells, which is unnecessarily expensive (and also currently runs in quadratic time with the number of cells in a sheet).
Comment 1 Javen O'Neal 2015-11-02 09:41:57 UTC
Created attachment 33246 [details]
changes to make hyperlinks accessible via HSSFSheet and SXSSFSheet
Comment 2 Javen O'Neal 2015-11-02 09:45:49 UTC
Applied in r1711923 to trunk.

Site docs updated in r1711924.
Comment 3 Dominik Stadler 2015-11-02 12:41:32 UTC
*** Bug 58507 has been marked as a duplicate of this bug. ***
Comment 4 Javen O'Neal 2015-11-02 13:06:18 UTC
After reading about the problems with Java's Cloneable interface[1], I replaced Cloneable interface with copy constructors in r1711951.

I wrote code for copying between hyperlink types (HSSFHyperlink/XSSFHyperlink). OOXML code is not available in TestHSSFHyperlink.java (results in compile error). Where should I place the HSSFHyperlink copy constructor unit test [2] in order for it to run as part of the suite?

[1] https://stackoverflow.com/questions/2427883/clone-vs-copy-constructor-which-is-recommended-in-java
[2] https://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFHyperlink.java?r1=1711952&r2=1711950&pathrev=1711952