Search before asking
Fesod version
main
JDK version
any
Operating system
Linux
Steps To Reproduce
Open an .xlsx whose cell A1 links to an external URL that has a fragment,
e.g. https://example.com/page#section.
<!-- xl/worksheets/sheet1.xml -->
<hyperlink ref="A1" r:id="rId1" location="section" display="frag"/>
<hyperlink ref="A2" r:id="rId2" display="plain"/>
<!-- xl/worksheets/_rels/sheet1.xml.rels -->
<Relationship Id="rId1" Target="https://example.com/page" TargetMode="External" Type=".../hyperlink"/>
<Relationship Id="rId2" Target="https://example.com/plain" TargetMode="External" Type=".../hyperlink"/>
extraHyperlinkFragment.xlsx
Current Behavior
[section, https://example.com/plain]
The fragment is reported as if it were a link inside the workbook, and the URL https://example.com/page is lost.
The same happens to a link to a cell in another workbook, other.xlsx#Sheet1!A1, which is stored the same way:
<hyperlink ref="A1" r:id="rId1" location="Sheet1!A1"/>
<Relationship Id="rId1" Target="other.xlsx" TargetMode="External" Type=".../hyperlink"/>
It is read back as Sheet1!A1, which looks like a link to a cell in the workbook being read.
Expected Behavior
[https://example.com/page#section, https://example.com/plain]
and other.xlsx#Sheet1!A1 for the other-workbook link. This is what POI returns for the same files (XSSFHyperlink.getAddress()).
Anything else?
HyperlinkTagHandler.startElement treats location and r:id as either/or: when location is present it reports it and returns before resolving r:id. That is right for links inside the workbook, which only carry location, but an external link with a # part carries both.
Are you willing to submit a PR?
Search before asking
Fesod version
main
JDK version
any
Operating system
Linux
Steps To Reproduce
Open an
.xlsxwhose cell A1 links to an external URL that has a fragment,e.g.
https://example.com/page#section.extraHyperlinkFragment.xlsx
Current Behavior
The fragment is reported as if it were a link inside the workbook, and the URL
https://example.com/pageis lost.The same happens to a link to a cell in another workbook,
other.xlsx#Sheet1!A1, which is stored the same way:It is read back as
Sheet1!A1, which looks like a link to a cell in the workbook being read.Expected Behavior
and
other.xlsx#Sheet1!A1for the other-workbook link. This is what POI returns for the same files (XSSFHyperlink.getAddress()).Anything else?
HyperlinkTagHandler.startElementtreatslocationandr:idas either/or: whenlocationis present it reports it and returns before resolvingr:id. That is right for links inside the workbook, which only carrylocation, but an external link with a#part carries both.Are you willing to submit a PR?