//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem;usingSystem.IO;usingSystem.Linq;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This sample shows how to find all occurrences of a string // in a DOCX document (see JsFrameworkExcerpt) using the// RangeBase.Find extension method provided by the// RangeBaseFindReplaceExtensions class.publicclassFindAll {publicGcWordDocumentCreateDocx() {// The string to find. Note that we use all lowercase,// as we specify the ignore case option in the find call:conststringfindPattern = "javascript framework"; // Load the document:var doc = newGcWordDocument(); doc.Load(Path.Combine("Resources", "WordDocs", "JsFrameworkExcerpt.docx")); // Find all occurrences of the search string, ignoring the case:var finds = doc.Body.Find(findPattern, newFindOptions(doc) { IgnoreCase = true }); // Print the number of found occurrences at the top of the document: doc.Body.Paragraphs.Insert($"Found {finds.Count()} occurrences of '{findPattern}' in the document.\n\n", InsertLocation.Start); // Done:return doc; } }}