poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hissink Muller <mar...@gmail.com>
Subject Adding Hyperlink support to POI-HSSF...? (2)
Date Sat, 19 Feb 2005 10:41:45 GMT
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 <markhm@gmail.com>
> 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: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message