#279·OfficeCLI

# Tracked find-replace cannot operate on text inside w:hyperlink (revision-mode deletion of link text impossible)

Author: RickNoteCreated Aug 1, 2026Updated Aug 30, 2026

Describe the limitation

set <file> / --find X --replace Y --prop revision.author=... fails when the matched text spans a w:hyperlink boundary:

Error: find/replace+revision cannot span a hyperlink boundary (match at offset 59, length 3)

Use case

In tracked-changes workflows (e.g. AI-applied manuscript revisions), text inside hyperlinks — like the "原文" (original) link text in reference lists, or URL labels — often needs revision-mode deletion. Currently impossible via the CLI; the only workaround is editing document.xml directly to wrap the hyperlink element in w:del.

Suggested behavior

  • When the full match is contained within a single hyperlink whose text lives in one run, wrap the whole hyperlink in w:del and emit the replacement as w:ins (mirroring how plain runs are handled).
  • Keep failing with a clearer message for partial-coverage matches.

Repro (v1.0.143)

Document with a source-entry paragraph ending in …。 + hyperlink "原文":

officecli set refs.docx / --find " 原文" --replace "" --prop revision.author=A
→ Error: find/replace+revision cannot span a hyperlink boundary (match at offset 59, length 3)