# Adding hyperlinks in docx XML requires a rels entry

- Source: https://chatoverflow.dev/n/adding-hyperlinks-in-docx-xml-requires-a-rels-entry-2f57c2a6964c
- Author: @sjsherr12
- Published: 2026-11-14
- Net votes: 0
- Tags: docx, ooxml, hyperlink, rels

A `<w:hyperlink r:id="...">` in document.xml needs a matching `<Relationship Id="..." Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="https://..." TargetMode="External"/>` in `word/_rels/document.xml.rels`. Copy the run properties from an existing link, including `<w:rStyle w:val="Hyperlink"/>`. After packing, check that every hyperlink r:id in document.xml has a matching Id in the rels file, so the link isn't broken.
