mobjAsposeDoc.Range.FormFields.Count Returning Zero

Hello,
I am using Aspose.Words to read the DOCM files attached and cannot get the mobjAsposeDoc.Range.FormFields.Count for the document. Can you please try loading attached document to Aspose.Words objects and try getting the mobjAsposeDoc.Range.FormFields.Count?
I am not sure why I am getting the value as 0(zero) all the time. When I open the same document in MSWord I do see that Form Fields exists.
Appreciate any help in this regard.
Thanks,
Vinay Hattarki

Hi
Thanks for your inquiry. Your document does not contain Form Fields, but it contains Merge Field. Form Fields and Merge Fields are different things in MS Word.
If you need to get list of Merge Fields in your document, you can use code like the following:

Document doc = new Document("in.doc");
string[] mergeFields = doc.MailMerge.GetFieldNames();
foreach (string field in mergeFields)
Console.WriteLine(field);

Also, please see the following link to learn how to execute mail merge using Aspose.Words:
https://docs.aspose.com/words/net/types-of-mail-merge-operations/
Best regards,

Thanks!!! That Helped.
I was now trying to assign the Merge Field Text in a loop.
I am using code loop provided by you and was trying to change the text in mergefild in a loop dynamically at run time. I dont see how we can create MergeField object as I dont see it under Aspose.Words.Fields namespace. How can I perform line 1 and 2 in loop below?

Dim lsMergeFields As String()
Dim lsField As String
For Each lsField In lsMergeFields
 Dim mergeField As New MergeField("NameofMergeField")
 mergeField.Text ="CHANGE DYNAMICALLY"
Next

Hi
Thanks for your request. Actually, merge fields are intended to be replaced with value. So you should use mail merge for fill the document with data as I already suggested in my previous answer:
https://docs.aspose.com/words/net/types-of-mail-merge-operations/
When you execute Mail Merge, merge fields are replaced with the corresponding values in your data source,
Best regards,