documentViewer.SearchOptions.Term = "red four wheels petrol"; documentViewer.SearchOptions.MatchOptions = MatchOptions.MatchAnyWord;
Improved: When using DocumentViewerMatchOptions.MatchAnyWord, now the quotation marks can be used to specify phrasesinside a query that is set via DocumentViewerSearchOptions.Term.For example;
red "four wheels" petrol will match red or four wheels or petrol or red four wheels petrol
red ""four wheels"" petrol will match red or "four wheels" or petrol or red "four wheels" petrol
documentViewer.SearchOptions.Term = "red \"four wheels\" petrol"; documentViewer.SearchOptions.MatchOptions = MatchOptions.MatchAnyWord; //If you have an array of phrases, you can surround them with quotation marks //and then join them with spaces to form a query: var phrases = new[] { "red", "four wheels", "petrol" }; var query = string.Join(" ", phrases.Select(p => $"\"{p}\"")); documentViewer.SearchOptions.Term = query; documentViewer.SearchOptions.MatchOptions = MatchOptions.MatchAnyWord;
Note that two consecutive quotation marks "" can be used to escape, i.e. to search for a quotation mark literally as ".The same feature can also be used in the Viewer's Find dialog.
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add notify@gleamtech.com to your trusted senders list in your email software.