Finally I implemented full support for Excel hyperlinks. All types of links are supported: file, url, email and internal. Created XLS with links can be opened in Excel and OpenOffice and both properly understand it. So, I hope I covered all the cases. I rewritten most of HyperlinkRecord and added pretty verbose tests for both record and usermodel levels. Everything seems to be working fine.
HLINK turned out to be a very unlogical beast. In some cases strings are stored as UTF-16LE, in some they are plain, not unicode bytes. Yegor > On Sat, 2 Feb 2008, Yegor Kozlov wrote: >> By the way, where did you find the implementation of HyperlinkRecord? >> Which Bug #? > Actually, google! I searched for some documentation on the record format, > and found an apache licenced stub implementation >> 1. HyperlinkRecord construction failed on non-URL links, in particular, >> on links to a place in worksheet. I added a check to prevent reading >> past EOF. > Excellent, thanks. I only tested it with the kinds of hyperlink I might > ever use >> 2. HyperlinkRecord.fillFields is incomplete. It works only with URL type >> of links. I didn't decode it yet but fillFields should behave something >> like this: >> >> Any thoughts how to decode it? > Create a couple of each type, and stare at the bytes until they make > sense? Otherwise, wait another few weeks, and hope it's covered by the > binary file format docs Microsoft are due to release then >> 3. Hyperlink is a special info attached to a cell. Very much like cell >> comment. To find a hyperlink you need to traverse through the sheet >> records and test row and column of found HyperlinkRecords. > Hmm, how does that work if I have hyperlinks on two different sheets? Say, > one in A2 on sheets 1 and 2, how do we tell those apart? >> I added HSSFHyperlink object and getHyperlink/setHyperlink to HSSFCell. >> For now only getHyperlink() works. >> >> setHyperlink is not yet implemented. First, we need to finish with >> HyperlinkRecord and figure out how to fill data for different types of >> links. Once this is implemented, assigning a hyperlink to a cell would >> be just appending a HyperlinkRecord to sheet records. > Sounds good. I'd suggest we wait a few weeks and see what docs we can get > then, unless you fancy staring at some byte arrays before then to make > sense of it all! > For now, I've added another test excel file, HyperlinksOnManySheets.xls. > This has web links, emails, and internal links, over several different > sheets. Ought to be a good starting point for testing further > functionality > Nick > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
