Replacer.ReplaceToImages

Replacer ReplaceToImages method. Replaces all occurrences of a specified character string pattern with a replacement string in the input file. Renders output to images.

ReplaceToImages(string, ImageSaveOptions, string, string, FindReplaceOptions)

Replaces all occurrences of a specified character string pattern with a replacement string in the input file. Renders output to images.

public static Stream[] ReplaceToImages(string inputFileName, ImageSaveOptions saveOptions, 
    string pattern, string replacement, FindReplaceOptions options = null)
ParameterTypeDescription
inputFileNameStringThe input file name.
saveOptionsImageSaveOptionsThe save options.
patternStringA string to be replaced.
replacementStringA string to replace all occurrences of pattern.
optionsFindReplaceOptionsFindReplaceOptions object to specify additional options.

Examples

Shows how to replace text in the document and save the result as images array.

Stream[] pages = Replacer.ReplaceToImages(MyDir + "Replacing.docx", new Saving.ImageSaveOptions(SaveFormat.Png), "findme", "Replacement Text");

See Also


ReplaceToImages(Stream, ImageSaveOptions, string, string, FindReplaceOptions)

Replaces all occurrences of a specified character string pattern with a replacement string in the input file. Renders output to images.

public static Stream[] ReplaceToImages(Stream inputStream, ImageSaveOptions saveOptions, 
    string pattern, string replacement, FindReplaceOptions options = null)
ParameterTypeDescription
inputStreamStreamThe input file stream.
saveOptionsImageSaveOptionsThe save options.
patternStringA string to be replaced.
replacementStringA string to replace all occurrences of pattern.
optionsFindReplaceOptionsFindReplaceOptions object to specify additional options.

Examples

Shows how to replace text in the document loaded from stream and save the result as images array.

using (Stream input = File.OpenRead(MyDir + "Replacing.docx"))
{
    Stream[] pages = Replacer.ReplaceToImages(input, new Saving.ImageSaveOptions(SaveFormat.Png), "findme", "Replacement Text");
}

See Also


ReplaceToImages(string, ImageSaveOptions, Regex, string, FindReplaceOptions)

Replaces all occurrences of a specified regular expression pattern with a replacement string in the input file. Renders output to images.

public static Stream[] ReplaceToImages(string inputFileName, ImageSaveOptions saveOptions, 
    Regex pattern, string replacement, FindReplaceOptions options = null)
ParameterTypeDescription
inputFileNameStringThe input file name.
saveOptionsImageSaveOptionsThe save options.
patternRegexA regular expression pattern used to find matches.
replacementStringA string to replace all occurrences of pattern.
optionsFindReplaceOptionsFindReplaceOptions object to specify additional options.

Examples

Shows how to replace text in the document using regular expression pattern and save the result as images array.

Regex pattern = new Regex(@"[a-zA-Z]{6}\d+");
string replacement = "Replacement Text";
Stream[] pages = Replacer.ReplaceToImages(MyDir + "Replacing.docx", new Saving.ImageSaveOptions(SaveFormat.Png), pattern, replacement);

See Also


ReplaceToImages(Stream, ImageSaveOptions, Regex, string, FindReplaceOptions)

Replaces all occurrences of a specified regular expression pattern with a replacement string in the input file. Renders output to images.

public static Stream[] ReplaceToImages(Stream inputStream, ImageSaveOptions saveOptions, 
    Regex pattern, string replacement, FindReplaceOptions options = null)
ParameterTypeDescription
inputStreamStreamThe input file stream.
saveOptionsImageSaveOptionsThe save options.
patternRegexA regular expression pattern used to find matches.
replacementStringA string to replace all occurrences of pattern.
optionsFindReplaceOptionsFindReplaceOptions object to specify additional options.

Examples

Shows how to replace text in the document loaded from stream using regular expression pattern and save the result as images array.

using (Stream input = File.OpenRead(MyDir + "Replacing.docx"))
{
    Regex pattern = new Regex(@"[a-zA-Z]{6}\d+");
    string replacement = "Replacement Text";
    Stream[] pages = Replacer.ReplaceToImages(input, new Saving.ImageSaveOptions(SaveFormat.Png), pattern, replacement);
}

See Also