hints:
The string looks like it is either 16-bit characters (that all happen to fit nicely in 8 bits) or "uncompressed unicode" -- however they also could be "rich text" that happens not to have any styling (you could make the "h" red and the "t" blue -- then the 0 might be another number -- there might be marker bits that change).
This is how we do it. I never did this record myself because it didn't look hard and no one ever paid for it so I didn't found it challenging enough to do "for fun". I imagine it was the same for other committers. So this "easy task" was never done.
-Andy
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: [email protected]
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/ .
--------------------------------------------------------------------- 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/
