FieldCharGetField Method

Returns a field for the field char.

Namespace:  Aspose.Words.Fields
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
Syntax
public Field GetField()

Return Value

Type: Field
A field for the field char.
Remarks
A new Field object is created each time the method is called.
Examples
Demonstrates how to retrieve the field class from an existing FieldStart node in the document.
Document doc = new Document(MyDir + "Table of contents.docx");

FieldChar fieldStart = (FieldChar)doc.GetChild(NodeType.FieldStart, 0, true);
Assert.AreEqual(FieldType.FieldTOC, fieldStart.FieldType);
Assert.AreEqual(false, fieldStart.IsDirty);
Assert.AreEqual(false, fieldStart.IsLocked);

// Retrieve the facade object which represents the field in the document
Field field = fieldStart.GetField();

Assert.AreEqual(false, field.IsLocked);
Assert.AreEqual(" TOC \\o \"1-3\" \\h \\z \\u ", field.GetFieldCode());

// This updates only this field in the document.
field.Update();
See Also