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
Syntaxpublic Field InsertField(
FieldType fieldType,
bool updateField
)
Public Function InsertField (
fieldType As FieldType,
updateField As Boolean
) As Field
public:
Field^ InsertField(
FieldType fieldType,
bool updateField
)
member InsertField :
fieldType : FieldType *
updateField : bool -> Field
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:
FieldA
Field object that represents the inserted field.
RemarksThis 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.
ExamplesShows 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