IgnoreFieldCodes
Contents
[
Hide
]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 FieldSeparator and FieldEnd).
To ignore whole field, please use corresponding option IgnoreFields
.
Examples
Shows how to ignore text inside field codes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertField("INCLUDETEXT", "Test IT!");
FindReplaceOptions options = new FindReplaceOptions {IgnoreFieldCodes = ignoreFieldCodes};
// Replace 'T' in document ignoring text inside field code or not.
doc.Range.Replace(new Regex("T"), "*", options);
Console.WriteLine(doc.GetText());
Assert.AreEqual(
ignoreFieldCodes
? "\u0013INCLUDETEXT\u0014*est I*!\u0015"
: "\u0013INCLUDE*EX*\u0014*est I*!\u0015", doc.GetText().Trim());
See Also
- class FindReplaceOptions
- namespace Aspose.Words.Replacing
- assembly Aspose.Words