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

Free Support Forum - aspose.com

Unable to extract the correct Merge Field

Hi

I am trying to use the Document Visitor class to retrieve the list of merge fields in my word document. Some of the merge fields that I have used in my template(word) document are more than 40 characters in length…for instance TableStart:Search: List of producs in my database. In MS word, the fields are truncated after 40 characters although if I switch to view the field codes, I see the full text. I have defined a class that inherits from Document visitor class…Node.GetText() of these merge fields returns the truncated version instead of returning the actual field text…Is there a way to get around this issue?

RAM

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

Thanks for your inquiry. You can use the following code to get merge field names from the document:

Document doc = new Document(@"Test073\in.doc");

foreach (string name in doc.MailMerge.GetFieldNames())

{

Console.WriteLine(name);

}

Hope this helps.

Best regards,