Class Replacer
Namespace: Aspose.Words.LowCode
Assembly: Aspose.Words.dll
Provides methods intended to find and replace text in the document.
public static class ReplacerInheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Methods
Replace(string, string, string, string)
Replaces all occurrences of a specified character string pattern with a replacement string in the input file.
public static int Replace(string inputFileName, string outputFileName, string pattern, string replacement)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
pattern string
A string to be replaced.
replacement string
A string to replace all occurrences of pattern.
Returns
The number of replacements made.
Replace(string, string, SaveFormat, string, string)
Replaces all occurrences of a specified character string pattern with a replacement string in the input file, with the specified save format.
public static int Replace(string inputFileName, string outputFileName, SaveFormat saveFormat, string pattern, string replacement)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The save format.
pattern string
A string to be replaced.
replacement string
A string to replace all occurrences of pattern.
Returns
The number of replacements made.
Replace(string, string, SaveFormat, string, string, FindReplaceOptions)
Replaces all occurrences of a specified character string pattern with a replacement string in the input file, with the specified save format and additional options.
public static int Replace(string inputFileName, string outputFileName, SaveFormat saveFormat, string pattern, string replacement, FindReplaceOptions options)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The save format.
pattern string
A string to be replaced.
replacement string
A string to replace all occurrences of pattern.
options FindReplaceOptions
Aspose.Words.Replacing.FindReplaceOptions object to specify additional options.
Returns
The number of replacements made.
Replace(Stream, Stream, SaveFormat, string, string)
Replaces all occurrences of a specified character string pattern with a replacement string in the input stream, with the specified save format.
public static int Replace(Stream inputStream, Stream outputStream, SaveFormat saveFormat, string pattern, string replacement)Parameters
inputStream Stream
The input stream.
outputStream Stream
The output stream.
saveFormat SaveFormat
The save format.
pattern string
A string to be replaced.
replacement string
A string to replace all occurrences of pattern.
Returns
The number of replacements made.
Replace(Stream, Stream, SaveFormat, string, string, FindReplaceOptions)
Replaces all occurrences of a specified character string pattern with a replacement string in the input stream, with the specified save format and additional options.
public static int Replace(Stream inputStream, Stream outputStream, SaveFormat saveFormat, string pattern, string replacement, FindReplaceOptions options)Parameters
inputStream Stream
The input stream.
outputStream Stream
The output stream.
saveFormat SaveFormat
The save format.
pattern string
A string to be replaced.
replacement string
A string to replace all occurrences of pattern.
options FindReplaceOptions
Aspose.Words.Replacing.FindReplaceOptions object to specify additional options.
Returns
The number of replacements made.
Replace(string, string, Regex, string)
Replaces all occurrences of a specified character string pattern with a replacement string in the input file using a regular expression.
public static int Replace(string inputFileName, string outputFileName, Regex pattern, string replacement)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
pattern Regex
A regular expression pattern used to find matches.
replacement string
A string to replace all occurrences of pattern.
Returns
The number of replacements made.
Replace(string, string, SaveFormat, Regex, string)
Replaces all occurrences of a specified character string pattern with a replacement string in the input file using a regular expression, with the specified save format.
public static int Replace(string inputFileName, string outputFileName, SaveFormat saveFormat, Regex pattern, string replacement)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The save format.
pattern Regex
A regular expression pattern used to find matches.
replacement string
A string to replace all occurrences of pattern.
Returns
The number of replacements made.
Replace(string, string, SaveFormat, Regex, string, FindReplaceOptions)
Replaces all occurrences of a specified character string pattern with a replacement string in the input file using a regular expression, with the specified save format and additional options.
public static int Replace(string inputFileName, string outputFileName, SaveFormat saveFormat, Regex pattern, string replacement, FindReplaceOptions options)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The save format.
pattern Regex
A regular expression pattern used to find matches.
replacement string
A string to replace all occurrences of pattern.
options FindReplaceOptions
Aspose.Words.Replacing.FindReplaceOptions object to specify additional options.
Returns
The number of replacements made.
Replace(Stream, Stream, SaveFormat, Regex, string)
Replaces all occurrences of a specified character string pattern with a replacement string in the input stream using a regular expression.
public static int Replace(Stream inputStream, Stream outputStream, SaveFormat saveFormat, Regex pattern, string replacement)Parameters
inputStream Stream
The input stream.
outputStream Stream
The output stream.
saveFormat SaveFormat
The save format.
pattern Regex
A regular expression pattern used to find matches.
replacement string
A string to replace all occurrences of pattern.
Returns
The number of replacements made.
Replace(Stream, Stream, SaveFormat, Regex, string, FindReplaceOptions)
Replaces all occurrences of a specified character string pattern with a replacement string in the input stream using a regular expression, with the specified save format and additional options.
public static int Replace(Stream inputStream, Stream outputStream, SaveFormat saveFormat, Regex pattern, string replacement, FindReplaceOptions options)Parameters
inputStream Stream
The input stream.
outputStream Stream
The output stream.
saveFormat SaveFormat
The save format.
pattern Regex
A regular expression pattern used to find matches.
replacement string
A string to replace all occurrences of pattern.
options FindReplaceOptions
Aspose.Words.Replacing.FindReplaceOptions object to specify additional options.
Returns
The number of replacements made.