Bug 53858 - Reading Hyperlink address having number sign(#) from cell giving improper link address
Summary: Reading Hyperlink address having number sign(#) from cell giving improper lin...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-12 11:53 UTC by Kirti Tandel
Modified: 2013-09-16 15:06 UTC (History)
0 users



Attachments
xsl file for testing (18.50 KB, application/vnd.ms-excel)
2012-09-12 11:53 UTC, Kirti Tandel
Details
Test program (2.73 KB, application/octet-stream)
2012-09-13 06:07 UTC, Kirti Tandel
Details
test.xls file used in program to read address of hyperlink in a cell (18.50 KB, application/vnd.ms-excel)
2012-09-13 06:08 UTC, Kirti Tandel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kirti Tandel 2012-09-12 11:53:44 UTC
Created attachment 29365 [details]
xsl file for testing

Step to reproduce issue:-
========================

1. Create a xls file with one cell with a hyperlink.(Address of hyperlink should having number sign(#) in it. e.g "http://www.bailii.org/databases.html#uk")

2. Try to read address of hyperlink. It will give link address as "uk".Only characters after Address number sign (#) is considered as hyperlink address.

Code snippet:-
=============

String strLinkAddress = cell.getHyperlink().getAddress();

It will return "uk" as link address instead of "http://www.bailii.org/databases.html#uk"

An xls file is attached for test.
Comment 1 Nick Burch 2012-09-12 15:43:12 UTC
What does BiffViewer report for the hyperlink related records? Do it show the full URL, or does it see just the anchor?
Comment 2 Kirti Tandel 2012-09-13 06:07:34 UTC
Created attachment 29367 [details]
Test program
Comment 3 Kirti Tandel 2012-09-13 06:08:35 UTC
Created attachment 29368 [details]
test.xls file used in program to read address of hyperlink in a cell
Comment 4 Kirti Tandel 2012-09-13 06:09:15 UTC
I'm just trying to read a address of hyperlink given in a cell.

But instead of giving a full URL it gives only characters after #.

I have attached a simple program  and a test xls file here in aatachment.
Comment 5 Nick Burch 2012-09-13 11:28:04 UTC
Please try using org.apache.poi.hssf.dev.BiffViewer to see if the hyperlink is stored in multiple records or not, and if BiffViewer can see the full url or just the anchor.
Comment 6 Kirti Tandel 2012-10-09 07:41:12 UTC
I have treid using org.apache.poi.hssf.dev.BiffViewer and the hyperlink is stored in records , and BiffViewer can see just the anchor in url.

record is shown as

[HYPERLINK RECORD]
    .range   = A1
    .guid    = 79EAC9D0-BAF9-11CE-8C82-00AA004BA90B
    .linkOpts= 0x0000001F
    .label   = kirti
    .moniker   = 79EAC9E0-BAF9-11CE-8C82-00AA004BA90B
    .textMark= uk
    .address   = uk
[/HYPERLINK RECORD]
Comment 7 Mark B 2012-10-09 08:11:20 UTC
Just found this on Microsoft's - http://support.microsoft.com/kb/202261 - do not know if is strictly relevant but it does indicate that the # character cannot be included within hyperlinks in Office documents. The focus of the document appears top be upon # characters embedded into file names but I do wonder if the same restriction may be applied here.
Comment 8 Kirti Tandel 2012-12-05 14:26:06 UTC
I have tried to found solution for this issue on net but can't got yet.

Is there any possibility that this issue can be resolved in future version of Apache POI.?
Comment 9 javier.pajaro 2013-09-16 14:04:25 UTC
I am having exactly the same problem. Is it planned a fix for this? Someone is working on this?
Comment 10 javier.pajaro 2013-09-16 14:07:59 UTC
(In reply to javier.pajaro from comment #9)
> I am having exactly the same problem. Is it planned a fix for this? Someone
> is working on this?

Sorry, I am using POI 3.9. The bug was reported under 3.8. Why is not considered important?
Comment 11 Nick Burch 2013-09-16 14:16:32 UTC
All work done on Apache POI is done by people who kindly volunteer their time. The importance of what work gets done is decided by those willing to put in their own time to do it!

If this bug is important to you, please consider investigating and submitting a patch. You would most likely need to read the Microsoft documentation on the format, run some sample files through something like BiffViewer to see how it works, then make changes to the POI code to handle how these hyperlinks are coded. If you get it working, please then attach the patch to this bug, so others can benefit!
Comment 12 javier.pajaro 2013-09-16 14:57:36 UTC
(In reply to Nick Burch from comment #11)
> All work done on Apache POI is done by people who kindly volunteer their
> time. The importance of what work gets done is decided by those willing to
> put in their own time to do it!
> 
> If this bug is important to you, please consider investigating and
> submitting a patch. You would most likely need to read the Microsoft
> documentation on the format, run some sample files through something like
> BiffViewer to see how it works, then make changes to the POI code to handle
> how these hyperlinks are coded. If you get it working, please then attach
> the patch to this bug, so others can benefit!

Ok, I will try. But, it would be easier for the guy who wrote the Hyperlink record. Dont you think the same? I am not asking for a new feature, just a fix.
Comment 13 Nick Burch 2013-09-16 15:06:07 UTC
(In reply to javier.pajaro from comment #12)
> Ok, I will try. But, it would be easier for the guy who wrote the Hyperlink
> record. Dont you think the same? I am not asking for a new feature, just a
> fix.

HyperlinkRecord was first introduced to the codebase over 5 years ago, and a quick "svn log" shows that a large number of people have worked on it over that time, both committers and external contributors. There's no one person who "owns" any of the code, so anyone can (and is encouraged to!) dive in and submit patches to enhance it