FindReplaceOptions.IgnoreFieldCodes

FindReplaceOptions IgnoreFieldCodes property. Gets or sets a boolean value indicating either to ignore text inside field codes. The default value is false.

FindReplaceOptions.IgnoreFieldCodes property

Gets or sets a boolean value indicating either to ignore text inside field codes. The default value is false.

public bool IgnoreFieldCodes { get; set; }

Remarks

This option affects only field codes (it does not ignore nodes between field separator and field end).

To ignore whole field, please use corresponding option IgnoreFields.

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