SubDocument.ReplaceAll(String, String, SearchOptions, DocumentRange) Method
In This Article
Finds all occurrences of the search string in the specified range, and replaces them with the replacement string.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
#Declaration
int ReplaceAll(
string textToFind,
string replaceWith,
SearchOptions options,
DocumentRange range
)
#Parameters
Name | Type | Description |
---|---|---|
text |
String | A string specifying the search text. |
replace |
String | A string specifying the replacement text. |
options | Search |
A Search |
range | Document |
A Document |
#Returns
Type | Description |
---|---|
Int32 | The number of replacements made. |
#Remarks
The code sample below shows how to replace “Application Programming Interface” to “API” in the document’s second section:
int replacements = wordProcessor.Document.ReplaceAll("Application Programming Interface", "API", SearchOptions.WholeWord, wordProcessor.Document.Sections[1].Range);
Console.WriteLine(String.Format("The {0} replacements were made", replacements));
See Also