In your frequently Word document, you may need search or find a certain word or phrase. Acctually, you can let your computer to do this kind of hard work especially your word document owns a large content. Maybe most of people are very familiar with this Microsoft Word advanced feature because it can save you a lot of time when you want to search or find some important data.
How to Use Word Search/Find Function?
By using Microsoft Word, you can search/find a certain word/phrase in your Word documents through two ways. First, you can use the Find command by hitting Ctrl+f which merely finds the word or phrase you're looking for. Alternatively, you can use the Find and Replace (if you want to replace the word/phrase you search) command by hitting Ctrl+h. There you can also specify the certain word/phrase that you'd like to replace and what word/phrase you want to replace it with. Both of those commands above are also can be found on the far right hand side of the Home tab, but what comes to my mind first is using the keyboard shortcuts which I think is much faster. Besides Microsoft Word, you also can use VB.NET
to set Word Search/Find Function
How to Use Spire.Doc for .NET to Set Word Search/Find Function?
Here, in order to see the result, we use highlight color to sign the text which need to be found. We use document.FindAllString method to search text. In this method, you should give four parameters: The first one is the text need to be found, the second one is used to distinguish majuscules and minuscules and the last one is used to judge whether the text which need to be replaced is a whole word or not.
Code of VB.NET from Spire.Doc for .NET
'Create word document
Dim document As New Document()
'load a document
Dim textSelections() As TextSelection = document.FindAllString("Word", True, True)
For Each selection As TextSelection In textSelections
selection.GetAsOneRange().CharacterFormat.Highligh tColor = Color.Yellow
'Save doc file.
'Launch the file.