Field count is not correct

Hi there,
Attaching a word document containing 66 fields but
System.out.println(wordDoc.getRange().getFields().getCount());
System.out.println(wordDoc.getChildNodes(NodeType.FIELD_START, true).getCount());

giving us different value.

Once we update the TOC field and check the count again, count again varies.

int count =0;
while (wordDoc.getChildNodes(NodeType.FIELD_START, true).get(count) != null) {
count++
}
System.out.println(count);
giving us correct value.

Please look into this.
Thanks.

Hi Praneeth,

Thanks for your inquiry. Perhaps, you are using an older version of Aspose.Words; as with Aspose.Words v14.3.0, I am unable to reproduce this problem on my side. Please check the attached image for detail.

I would suggest you please upgrade to the latest version of Aspose.Words i.e. v14.3.0 and let us know how it goes on your side. I hope, this will help.

Ok I see. Thanks Tahir for quick reply.