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)

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)
ParameterTypeDescription
inputFileNameStringThe input file name.
saveOptionsImageSaveOptionsThe save options.
patternStringA string to be replaced.
replacementStringA string to replace all occurrences of pattern.

See Also


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)
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)

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)
ParameterTypeDescription
inputStreamStreamThe input file stream.
saveOptionsImageSaveOptionsThe save options.
patternStringA string to be replaced.
replacementStringA string to replace all occurrences of pattern.

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)
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.

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

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"))
            {
                string replacement = "Replacement Text";
#if PYNET
                Stream[] pages = Replacer.ReplaceToImagesRegex(input, new Saving.ImageSaveOptions(SaveFormat.Png), @"[a-zA-Z]{6}\d+", replacement);
#else
                Stream[] pages = Replacer.ReplaceToImages(input, new Saving.ImageSaveOptions(SaveFormat.Png), new Regex(@"[a-zA-Z]{6}\d+"), replacement);
#endif
            }

See Also