We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

UpdateFields for just a selection of fields

Hello aspose team!

I have a template document and I want to update and/or remove some of the contained fields.

I know the method Document.UpdateFields().

Unfortunately I am not allowed to update all of the fields. What I really would appreciate would be a method with the following signature: void UpdateFields(Func<string, FieldType, bool> selector)(where string would be the field code).

The call would then look like:
Document.UpdateFields((field, fieldType) => field.GetFieldCode().Contains(“MyPrefix_”))

(same applies to removal of fields)

Also, I was not able to find a possibility to retrieve field instances (the only one I found is creating a new field with the DocumentBuilder). But as my fields already exist, it is of no use for me.

Do I have to select all FieldStarts and parse and update the fields on my own? Aspose.Words does already do this job with UpdateFields(). Is there a possibility to parameterize is function (in the near future)?



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. In one of future version we will consider to provide an ability to get Field object by FieldStart. This will allow you to iterate through all Fields and update only required fields. We will let you know once this issue is resolved.

Best regards,

Hi Marty,

Thanks for your inquiry.

You may want to look into using the code from this thread here which may work for you in the mean time.


The issues you have found earlier (filed as WORDSNET-3518) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.