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

Free Support Forum - aspose.com

Incorrect FormFields count (some FormFields are missing) in DOC

Aspose.Words v6.1.0.0

Working with attached document. FormFields count by Aspose.Words is 29. FormFields count by Microsoft Word Primary Interop Assemblies 2007 (PIA) + Microsoft Word 2007 is 66. Compare collections using my sample code. Some FormFields are missing.

Sample code for Aspose engine:

Aspose.Words.Document asposeDocument = new Aspose.Words.Document("LS-Aspose-B02-Sample-FormFieldsCount.doc");
Console.WriteLine("[Aspose]\tFormFields count: {0}", asposeDocument.Range.FormFields.Count);
foreach (Aspose.Words.Fields.FormField asposeFormField in asposeDocument.Range.FormFields)
Console.WriteLine("[Aspose]\tFormField Name: \"{0}\"\t\"{1}\"", asposeFormField.Name, asposeFormField.Result);

Sample code for PIA engine:

Microsoft.Office.Interop.Word.ApplicationClass wordInstance = new Microsoft.Office.Interop.Word.ApplicationClass();
object none = Missing.Value;
object documentPathObject = "LS-Aspose-B02-Sample-FormFieldsCount.doc";
Microsoft.Office.Interop.Word._Document wordDocument = wordInstance.Documents.Open(ref documentPathObject, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none);
Console.WriteLine("[PIA] FormFields count: {0}", wordDocument.FormFields.Count);
foreach (Microsoft.Office.Interop.Word.FormField wordFormField in wordDocument.FormFields)
Console.WriteLine("[PIA] FormField Name: \"{0}\"\t\"{1}\"", wordFormField.Name, wordFormField.Result);
wordDocument.Close(ref none, ref none, ref none);
wordInstance.Quit(ref none, ref none, ref none);

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

Thanks for your request. Most likely, you are using Aspose.Words in evaluation mode and your document is truncated.

I tested this using licensed version of Aspose.Words and it returns 66.

Best regards.

Yes. Sorry for mistake. Licensed version really returns a collection with 66 FormFields.