Is it possible to determine if a MailMerge field is within a Run?

Hello.

When iterating over the Runs contained in a document, is there some way to determine if a Run contains a MailMerge field?

My end goal here is to collect some data on our library of documents that includes the mail merge fields used and page in the document it’s used on. I’m already iterating over the runs to pull out FontInfo data so this would be pretty convenient.

Thanks!

Hello,
Thank you for your inquiry.
You can use the code here in this example in our documentation: https://docs.aspose.com/words/java/working-with-fields/
Hope this helps.

Hi there,
Thanks for your inquiry.
Do you mean check if a run is contained within a field? This because runs cannot contain fields, only paragraphs contain fields. Fields are made up of special nodes which appear as siblings of runs in a paragraph and wrap around the nodes contained within the field. If there is any confusion please see the structure of the Document Object Model here for details.
You can quickly find if a run is inside a field by using the SelectNodes method. You can find details and code on the second example on this API page here.
Note that this does not find runs within fields which span more over multiple paragraphs (most fields do not do this but it is possible).
Thanks,

thanks guys.

Also, just a nit pick … there is a typo on https://docs.aspose.com/words/java/aspose-words-document-object-model/
Screenshot
http://i.imgur.com/gfVDY.png

Hi there,
Thanks for pointing that out to me. I have noticed this spelling mistake before and it has been fixed in the .NET version of the documentation which is updated on the site already.
As soon as autoporting to Java is complete I will update this page in the Java documentation as well.
Thanks,

Hi there,
Also note that sometime shortly we will be releasing the next version of the public field api. This should include a built-in method to find the field of a supplied node e.g finding the field that a Run node belongs to.
We will inform you as soon as this is ready.
Thanks,

Any idea on the ETA?

Hi

Thanks for your request. Please expect a reply before next hotfix (within 3-4 weeks). We might just fix the problem or provide you more information.
Best regards,

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

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