DocumentBuilderInsertField Method (FieldType, Boolean)

Inserts a Word field into a document and optionally updates the field result.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Field InsertField(
	FieldType fieldType,
	bool updateField
)

Parameters

fieldType
Type: Aspose.Words.FieldsFieldType
The type of the field to append.
updateField
Type: SystemBoolean
Specifies whether to update the field immediately.

Return Value

Type: Field
A Field object that represents the inserted field.
Remarks

This method inserts a field into a document. Aspose.Words can update fields of most types, but not all. For more details see the InsertField(String, String) overload.

Examples
Shows how to insert a field into a document using FieldType.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("This field was inserted/updated at ");
builder.InsertField(FieldType.FieldTime, true);

doc.Save(ArtifactsDir + "DocumentBuilder.InsertFieldByType.doc");
See Also