Skip to content

xlsx: cell hyperlinks are dropped, while ODS preserves the same link #192

Open

Description

@rahul05ranjan

A spreadsheet cell whose display text is a clickable hyperlink loses the link entirely in the XLSX reader. The ODF reader keeps the same thing, so the same workbook saved as .ods and .xlsx converts differently.

What is missing

src/formats/sheet/xlsx.rs reads sheetData (line 273) and mergeCells (line 306) from each worksheet — nothing else. The <hyperlinks> element, its r:id references, and per-sheet relationship parts are never read; grep -i hlink over src/formats/sheet/ finds nothing, and the binary readers are in the same state: xls.rs does not parse the BIFF HLINK record (0x01B8) and xlsb.rs does not parse the BrtBeginHlink records.

The document model and renderer do support links inside cells: Inline::Link renders as [text](url) in table cells, and ODS cell text goes through the ODF text reader, whose text:a case (src/formats/odf/text.rs:340) resolves xlink:href into LinkTarget::External — ODS cell hyperlinks convert today.

Repro

Same content twice (0.2.4, commit 261fc25):

XLSX — sheet1.xml has <c r="A1" t="inlineStr"><is><t>Firecrawl docs</t></is></c> plus <hyperlink ref="A1" r:id="rIdH"/>, with the worksheet rels pointing at https://docs.firecrawl.dev (TargetMode="External"):

|  |
| --- |
| Firecrawl docs |

ODS — one cell with <text:p><text:a xlink:href="https://docs.firecrawl.dev">Firecrawl docs</text:a></text:p>:

|  |
| --- |
| [Firecrawl docs](https://docs.firecrawl.dev) |

Excel shows a link in both; the Markdown differs.

Direction

For XLSX: load each worksheet's rels part (rels_part_for already exists in src/package/relationships.rs), collect <hyperlinks>/<hyperlink> entries (ref + resolved target, external vs internal like fields::classify_rel_target), and wrap the rendered cell text in Inline::Link when a hyperlink covers the cell. location attributes (in-sheet anchors) would map to LinkTarget::Anchor. BIFF HLINK (xls) and the XLB records could follow the same mapping.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions