'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsGrapeCity.Documents.Word '' This sample shows how to replace all occurrences of a string'' in a DOCX document (see JsFrameworkExcerpt) using the'' RangeBase.Find extension method provided by the'' RangeBaseFindReplaceExtensions class.PublicClassReplaceTextPublicFunctionCreateDocx() AsGcWordDocument'' The text to find:ConsttFind = "javascript"'' The replacement:ConsttRepl = "ArabicaScroll" '' Load the original JsFrameworkExcerpt document:Dim doc = NewGcWordDocument() doc.Load(Path.Combine("Resources", "WordDocs", "JsFrameworkExcerpt.docx")) '' Replace all occurrences of the search text in the document body'' (note the options that we change from defaults):Dim nreplacements = doc.Body.Replace(tFind, tRepl, NewFindReplaceOptions(doc) With {.IgnoreCase = True, .RegularExpressions = False}) '' Add a note at the end of the document: doc.Body.Sections.Last.GetRange().Paragraphs.Add($"DsWord replaced {nreplacements} occurrences of '{tFind}' with '{tRepl}' on {Util.TimeNow():R}.") '' Done:Return docEndFunctionEndClass