Does this help?

HLINK â Hyperlink

 BIFF2


 BIFF3


BIFF4S


BIFF4W


 BIFF5


 BIFF7


 BIFF8


BIFF8X






   â


   â


   â


   â


   â


   â


 01B8H


 01B8H







In Excel, every cell may contain a hyperlink. The HLINK record refers to
one cell address or a cell range where all cells contain the same
hyperlink. Every hyperlink can contain a text mark and a description
that is shown in the sheet instead of the real link. Text marks are
appended behind a link, separated by the hash sign (â#â).

Examples for text marks: www.example.org#table1 or C:
\example.xls#Sheet1!A1.

Inside of this record strings are stored in several formats. Sometimes
occurs the character count, otherwise the character array size (in
16 bit character arrays the character count is half of the array size).
Furthermore some strings are zero-terminated, others not. They are
stored either as 16 bit character arrays or as 8 bit character arrays,
independent of the characters.

Common Record Contents

Each HLINK record starts with the same data items and continues with
special data related to the current type of hyperlink. It starts with a
cell range. Each cell of this range will contain the same hyperlink.

Record HLINK, BIFF8:

         Offset


          Size


Contents


           0


           2


Index to first row


           2


           2


Index to last row


           4


           2


Index to first column


           6


           2


Index to last column


           8


           16


GUID of StdLink:
D0H C9H EAH 79H F9H BAH
CEH 11H 8CH 82H 00H AAH
00H 4BH A9H 0BH
(79EAC9D0-BAF9-11CE-8C82-00AA004BA90B)


           24


           4


Unknown value: 00000002H


           28


           4


Option flags (see below)


          [32]


           4


(optional, see option
flags) Character count
of description text,
including trailing zero
word (dl)


          [36]


          2âdl


(optional, see option
flags) Character array
of description text, no
Unicode string header,
always 16 bit
characters,
zero-terminated


         [var.]


           4


(optional, see option
flags) Character count
of target frame,
including trailing zero
word (fl)


         [var.]


          2âfl


(optional, see option
flags) Character array
of target frame, no
Unicode string header,
always 16 bit
characters,
zero-terminated






Special data (â5.36.2
and following)


         [var.]


           4


(optional, see option
flags) Character count
of the text mark,
including trailing zero
word (tl)


         [var.]


          2âtl


(optional, see option
flags) Character array
of the text mark without
â#â sign, no Unicode
string header, always
16 bit characters,
zero-terminated



The special data parts in the following are described with relative
offsets (starting again by zero). The real offset inside of the record
data (without header) is either 32 (without description) or 36+2âdl
(with description).


      * Option flags
        


The option flags specify the following content of the record.

       Bit


       Mask


Contents


        0


    00000001H


0 = No link extant


1 = File link or
URL


        1


    00000002H


0 = Relative file
path


1 = Absolute path
or URL


     2 and 4


    00000014H


0 = No description


1 (both bits) =
Description


        3


    00000008H


0 = No text mark


1 = Text mark


        7


    00000080H


0 = No target
frame


1 = Target frame


        8


    00000100H


0 = File link or
URL


1 = UNC path
(incl. server
name)



Hyperlink to a URL (Uniform Resource Locator)

These data fields occur for links which are not local files or files in
the local network (for instance HTTP and FTP links and e-mail
addresses). The lower 9 bits of the option flags field must be
0.x00x.xx112 (x means optional, depending on hyperlink content). The
GUID could be used to distinguish a URL from a file link.

         Offset


          Size


Contents


           0


           16


GUID of URL Moniker:
E0H C9H EAH 79H F9H BAH
CEH 11H 8CH 82H 00H AAH
00H 4BH A9H 0BH
(79EAC9E0-BAF9-11CE-8C82-00AA004BA90B)


           16


           4


Size of character array
of the URL, including
trailing zero word (us).
There are us/2-1
characters in the
following string.


           20


           us


Character array of the
URL, no Unicode string
header, always 16 bit
characters,
zero-terminated



Hyperlink to a Local File

These data fields are for links to files on local drives. The path of
the file can be complete with drive letter (absolute) or relative to the
location of the workbook. The lower 9 bits of the option flags field
must be 0.x00x.xxx12. The GUID could be used to distinguish a URL from a
file link.

         Offset


          Size


Contents


           0


           16


GUID of File Moniker:
03H 03H 00H 00H 00H 00H
00H 00H C0H 00H 00H 00H
00H 00H 00H 46H
(00000303-0000-0000-C000-000000000046)


           16


           2


Directory up-level
count. Each leading
â..\â in the file link
is deleted and increases
this counter.


           18


           4


Character count of the
shortened file path and
name, including trailing
zero byte (sl)


           22


           sl


Character array of the
shortened file path and
name in 8.3 DOS format.
This field can be filled
with a long file name
too. No Unicode string
header, always 8 bit
characters,
zero-terminated.


         22+sl


           24


Unknown byte sequence:
FFH FFH ADH DEH 00H 00H
00H 00H
00H 00H 00H 00H 00H 00H
00H 00H
00H 00H 00H 00H 00H 00H
00H 00H


         46+sl


           4


Size of the following
file link field
including string length
field and additional
data field (sz). If sz
is zero, nothing will
follow (except a text
mark).


        [50+sl]


           4


(optional) Size of
character array of the
extended file path and
name (xl). There are
xl/2 characters in the
following string.


        [54+sl]


           2


(optional) Unknown byte
sequence: 03H 00H


        [56+sl]


           xl


(optional) Character
array of the extended
file path and name (xl),
no Unicode string
header, always 16 bit
characters, not
zero-terminated



Hyperlink to a File with UNC (Universal Naming Convention) Path

These data fields are for UNC paths containing a server name (for
instance â\\server\path\file.xlsâ). The lower 9 bits of the option flags
field must be 1.x00x.xx112.

         Offset


          Size


Contents


           0


           4


Character count of the
UNC, including trailing
zero word (fl)


           4


          2âfl


Character array of the
UNC, no Unicode string
header, always 16 bit
characters,
zero-terminated.



Hyperlink to the Current Workbook

In this case only the text mark field is present (optional with
description).

Example: The URL â#Sheet2!B1:C2â refers to the given range in the
current workbook.

The lower 9 bits of the option flags field must be 0.x00x.1x002.


On Sat, 2005-02-19 at 11:41 +0100, Mark Hissink Muller wrote:

> LS,
> 
> Continuing my initial mail (see below) to the poi-user-list; I
> realized it would be more appropriate to discuss on the poi-dev-list.
> 
> I've discovered the BiffViewer and I'm able to print the binary-data
> for an example URL which I put in cell A1:
>       
>       [[http://www.cnn.com CNN]]
> 
> -----UNKNOWN RECORD FOR SID: 440------------------------
> 00000000 00 00 00 00 00 00 00 00 D0 C9 EA 79 F9 BA CE 11 ...........y....
> 00000010 8C 82 00 AA 00 4B A9 0B 02 00 00 00 17 00 00 00 .....K..........
> 00000020 04 00 00 00 43 00 4E 00 4E 00 00 00 E0 C9 EA 79 ....C.N.N......y
> 00000030 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B 28 00 00 00 .........K..(...
> 00000040 68 00 74 00 74 00 70 00 3A 00 2F 00 2F 00 77 00 h.t.t.p.:././.w.
> 00000050 77 00 77 00 2E 00 63 00 6E 00 6E 00 2E 00 63 00 w.w...c.n.n...c.
> 00000060 6F 00 6D 00 2F 00 00 00                         o.m./...
> -----UNKNOWN RECORD FOR SID: 440------------------------
> 
> I'm now implementing my new HyperlinkRecord [1], but I could use a
> little help on which fields to choose for this class an how to parse
> the label and URL. Basically implementing:
> 
>       protected void fillFields(byte[] data, short size, int offset);
>       public int serialize(int offset, byte[] data);
> 
> Thanks for your thoughts.     
> 
> Cheers,
> - Mark
> 
> [1] - public class HyperlinkRecord extends Record implements
> CellValueRecordInterface
> 
> 
> 
> 
> > ---------- Forwarded message ----------
> > From: Mark Hissink Muller <[EMAIL PROTECTED]>
> > Date: Sat, 19 Feb 2005 09:31:48 +0100
> > Subject: Adding Hyperlink support to POI-HSSF...?
> > To: poi-user@jakarta.apache.org
> > 
> > 
> > LS,
> > 
> > Kindly I would like to ask your thoughts on adding support for cells
> > with a hyperlink to POI-HSSF. I've been looking into the component and
> > I've learned the following:
> > 
> >         - At first, the RecordFactory is initialized [1] loading all the
> > Record-classes that are available for the Excel-fileformat and
> > classifying by their sid.
> >         - When an Excel-file is read; the InputStream is processed [2] and
> > Record-elements are created from the stream that is read.
> >         - In a later stage Workbook(s)[3], HSSFSheet(s)[4], HSSFRow(s)[5] 
> > and
> > HSSFCell(s)[6] are created from the List of Record(s).
> >         - Zooming in on the creation of an HSSFCell; the type is determined
> > from the 'CellValueRecordInterface cval' [7] where either a
> > CELL_TYPE_STRING, CELL_TYPE_NUMERIC, etc. is assigned as
> > cellType-attribute.
> > 
> > Currently, CELL_TYPE_HYPERLINK is not a known cellType, but instead a
> > cell containing an hyperlink is merely recognized as a
> > CELL_TYPE_STRING with the the label as it's stringValue. The URL
> > itself is discarded, so it seems. To be able to add support for the
> > Hyperlink, I reckon that I need to answer the following questions:
> > 
> >         1. What is the sid for a Record which indicates an Excel-cell which
> > contains the Hyperlink?
> >         2. How is the Hyperlink correctly read and turned into a proposed
> > Hyperlink when parsing?
> > 
> > When printing the list of records that are read for a simple
> > example-worksheet with one URL in Cell A1, I see several
> > UnknownRecord(s); 448, 239, 440, 239 and 239. Judging by the
> > recordSize; I would say 440 is my best/only bet with a recordSize of
> > 108. All others have recordSizes 4 (sid 448) or 10 (sid 239).
> > 
> > Do my investigation and questions align with your ideas? Can anyone
> > confirm that sid 440 is the one to investigate? Do you have any other
> > suggestions?
> > 
> > Thanks for your thoughts.
> > 
> > Regards,
> > - Mark
> > 
> > [1] - org.apache.poi.hssf.record.RecordFactory{ ... private static Map
> >           recordsMap  = recordsToMap(records); ... }
> > [2] - org.apache.poi.hssf.usermodel.HSSFWorkbook { ... List records =
> > RecordFactory.createRecords(stream); ... }
> > [3] - org.apache.poi.hssf.usermodel.HSSFWorkbook { ... workbook =
> > Workbook.createWorkbook(records); ... }
> > [4] - org.apache.poi.hssf.usermodel.HSSFWorkbook { ... HSSFSheet
> > hsheet = new HSSFSheet(workbook, sheet); ... }
> > [5] - org.apache.poi.hssf.usermodel.HSSFSheet { ...
> > createRowFromRecord(row); ... }
> > [6] - org.apache.poi.hssf.usermodel.HSSFSheet { ...
> > hrow.createCellFromRecord( cval ); ... }
> > [7] - orc.apache.poi.hssf.usermodel.HSSFCell { ... private int
> > determineType(CellValueRecordInterface cval) ... }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/
> 

-- 

Reply via email to