We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Check string in document

How can I check if string found in document? I tried doc.hasrevisions, but that does not seem to be working.


You can meet this requirement by using the Find and Replace functionality of Aspose.Words for .NET.

For example:

Document doc = new Document(fileName);
// find/detect string in Word document
int count = doc.Range.Replace("pattern", "pattern");
if (count > 0)
        // String found

Hope, this helps.