Skip to content Skip to sidebar Skip to footer

Office.js Select Text And Replace It With A ContentControl

I have the following use case using Office.js: search for some text with body.search() after finding the text, can be multiple occurrences, iterate through them and replace them w

Solution 1:

After you searched the strings, body.search will return a collection to you and you can loop the range collection and call range.insertText("...", "replace"). This insertText method will also return a range and then you can call range.insertContentControl on it. I think this will help you achieve the goal.


Post a Comment for "Office.js Select Text And Replace It With A ContentControl"