Free Support Forum -

Problem with FormFields


I am working with aspose.word and I am having a problem with FormFields. I am trying to gather a collection of all the formFields and put their result and name into a 2 dimensional array. Everything works fine, except the last field is not recognized. I have ensured it is not the field in question. I’m unsure where to go. Here is the code:

//Open the default document template
Document doc = new Document(sPath);
FormFields documentFormFields = doc.Range.FormFields;

string[,] valArray = new string[documentFormFields.Count,2];
for(int i=0;i<documentFormFields.Count;i++)
valArray[i,0] = documentFormFieldsIdea.Name.ToString();
valArray[i,1] = documentFormFieldsIdea.Result.ToString();

return valArray;

Any ideas?


Thank you for considering Aspose.

Please attach the template containing the form fields.

Here is the file:

After running your code, I have got the following results:

documentFormFields.Count == 13

valArray[12, 0] == "HCDDComments"
valArray[12, 1] == ""

In other words, the last form field is recognized properly. What results are you getting? Maybe there is an extra form field I have missed?

Thanks for your response. I’m not sure what the problem was, probably trying to do too much on a Friday. Anyway, the problem seems to have resolved itself. Thank you for your assistance.