ReplacerContext Class
Wordize.Replacing.ReplacerContext class. Find/replace operation context.
ReplacerContext class
Find/replace operation context.
public class ReplacerContext : ProcessorContext
Constructors
| Name | Description |
|---|---|
| ReplacerContext() | The default constructor. |
Properties
| Name | Description |
|---|---|
| FindReplaceOptions { get; } | Find/replace options. |
| FontSettings { get; set; } | Allows to specify document font settings. |
| LayoutOptions { get; } | Document layout options used by the processor. |
| WarningCallback { get; set; } | Warning callback used by the processor. |
Methods
| Name | Description |
|---|---|
| SetReplacement(Regex, string) | Sets pattern and replacement used by find/replace operation. |
| SetReplacement(string, string) | Sets pattern and replacement used by find/replace operation. |
Examples
Shows how to configure find/replace options to ignore matches in particular document elements.
ReplacerContext context = new ReplacerContext();
context.SetReplacement("findme", "Replacement Text");
context.FindReplaceOptions.IgnoreDeleted = true;
context.FindReplaceOptions.IgnoreFieldCodes = true;
context.FindReplaceOptions.IgnoreFields = true;
context.FindReplaceOptions.IgnoreFootnotes = true;
context.FindReplaceOptions.IgnoreInserted = true;
context.FindReplaceOptions.IgnoreShapes = true;
context.FindReplaceOptions.IgnoreStructuredDocumentTags = true;
Replacer.Create(context)
.From(MyDir + "Replacing.docx")
.To(ArtifactsDir + "Replacer.FindReplaceOptionsIgnore.docx")
.Execute();
See Also
- class ProcessorContext
- namespace Wordize.Replacing
- assembly Wordize