Word: Search for text in text boxes in OfficeJS

Word: Search for text in text boxes in OfficeJS
0

Upvotes

Upvote

 Jul 16 2024
0 Comments 
New

In Word, text in text boxes (w:txbxContent in the OOXML) cannot be found using search(...) on a document's body or any of its ranges. This text is findable when using Word manually (i.e., using the search bar).

 

Lack of support for text in text boxes makes it difficult for add-ins to interact with documents that include them (which, notably, include a lot of docs converted from PDFs).

  • Add-ins can't implement "scroll to text" functionality for text that is in text boxes, because search(...) is unable to find the text
  • Add-ins can't insert tracked changes into text boxes, because search(...) is unable to find the text and return a Range object that can be updated

 

An ideal solution would simply update the existing search(...) API so it found text within text boxes and returned the relevant ranges.