Customize Field Properties

Aspose.Words provides the ability to programmatically interact with various field properties. In this article, we will look at a couple of examples so that you understand the basic principle of working with field properties. You can see the full list of properties for each field type in the corresponding class.

Field Property Update

Sometimes users need to change the value of a field property. For example, update the AuthorName property of the AUTHOR field or change the FieldName property of the MERGEFIELD field.

The following code example shows how to rename merge fields in a Word document:

Field Display Result

Aspose.Words provides a property to obtain the field’s result for fields that do not have a field separator node. We call this “fake result” or display result; MS Word displays it in the document by calculating the field’s value on the fly, but there is no such value in the document model.

The following code example shows the usage of DisplayResult property: