FindReplaceOptionsIgnoreFields Property

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

Namespace:  Aspose.Words.Replacing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public bool IgnoreFields { get; set; }

Property Value

Type: Boolean

ExpandedExamples

Shows how to ignore text inside fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert field with text inside
builder.InsertField("INCLUDETEXT", "Text in field");

Regex regex = new Regex("e");
FindReplaceOptions options = new FindReplaceOptions();
// Replace 'e' in document ignoring/not ignoring text inside field
options.IgnoreFields = isIgnoreFields;

doc.Range.Replace(regex, "*", options);

Assert.AreEqual(doc.GetText(),
    isIgnoreFields
        ? "\u0013INCLUDETEXT\u0014Text in field\u0015\f"
        : "\u0013INCLUDETEXT\u0014T*xt in fi*ld\u0015\f");

ExpandedSee Also