filters out relevant hit

Nils Lockean 1 Reputation point

Our Word add-in needs to select a piece of text between startOffset A and endOffset B. Since the Office JS API doesn't provide a way to set a selection between start/end positions the body text, we use the search function. This works fine in most cases, however not when the same text is repeated multiple times.

Suppose i want to select "test test" in the document body "test test test". There are two occurrences of "test test" in this document body but the search API only finds one: "[test test] test". I need to select the second occurrence, "test [test test]", but can't seem to get the search API to find it.

Has anyone else found a solution for this issue?

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
941 questions
{count} votes