Free Support Forum - aspose.com

MergeField TableStart reported incompletely by Node#GetText()

Hello

We have a MergeField in a .doc template

TableStart:ProjectPersonRoles

When browsing the tables using the .NET API on this particular Node GetText() returns

TableStart:ProjectPerso

In the same document other MergeFields which are in fact TableStart work fine, only this one fails.

Any known issues applicable?

Thank you.

Kind regards

Bart

Hi Bart,

Thanks for your request. Could you please attach your document and code here for testing? We will check the issue and provide you more information.

Best regards,

Please find attachment on original post.

Hi

Thank you for additional information. There is no bug in Aspose.Words. This occurs because field code of this field is represented by two Run nodes. Please open the document in DocumentExplorer (Aspose.Words demo app) to make sure. Also please see the attached screenshot.

If you need to get full field code, you should get text of all runs between FieldStart and FieldSeparator nodes.

Also, you can try calling JuinRunsWithSameFormating method:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.document.joinrunswithsameformatting.html

Best regards,

Hi there,

In addition, if you are scanning the text of fields to find the names of the merge fields, you can instead achieve this more easily by using the MailMerge.GetFieldNames method which retrieves the names of all MergeFields in the document.

Thanks,