Free Support Forum - aspose.com

How to update individual fields in an existing document

In this thread, another user was looking for a way to update an individual existing field in an existing document. At the time there was no way to enumerate the fields in an existing document, so a workaround was presented.

The last post in the thread implies that it should now be possible to get an individual field and update it from an existing document, per the fix for ticket WORDSNET-3518. Are there any instructions on how to use that? I don't see anything in the documentation that tells me how to get an individual field object.

Also, have you considered implementing a version of the UpdateFields method which will update all fields of a particular type?

Thanks for any help on this.

Hi Michael,


Thanks for your inquiry. As suggested here, you can simply iterate through a collection of Fields returned by a particular Range and call the Update method on the Field facade as follows:

foreach (Field field in doc.Range.Fields){

if (field.Start.FieldType == FieldType.FieldDate)

field.Update();


If we can help you with anything else, please feel free to ask.

Best regards,