Skip to content

Hyperlinks get corrupted when merging Word documents #2

@Oreoxmt

Description

@Oreoxmt

When merging Word documents using merge_word_docs_with_tables(), hyperlinks in the source document's tables become broken. This occurs because the code is handling relationship IDs as absolute references instead of preserving the original Word XML reference structure.

Technical Root Cause

Word documents use a relative reference system for relationships in their XML structure. The current merge implementation converts these to absolute references, which breaks the document's internal reference integrity. Specifically:

  • Original relationship IDs in the source document's XML are being overwritten
  • The parent-child reference structure is not maintained during the merge
  • Word's XML relationship mapping is not properly preserved

Current Behavior

When tables are merged, their hyperlink references are converted to absolute IDs, breaking the document's internal reference structure and causing links to point to incorrect destinations.

Expected Behavior

The merge process should preserve the original XML relationship structure of the source document's tables, maintaining the integrity of hyperlink references.

Impact

This issue breaks document integrity by corrupting hyperlink references, potentially leading to broken or misdirected links in the final document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions