Wrong word count

I am getting wrong word count values comparing to MS-Word word count values for specific document which have the hidden properties,

MS-Word count values: Word count – 21
Char count – 103
Char with spaces count – 138

Aspose count values: Word count – 68
Char count – 317
Char with spaces count – 388

I am getting aspose values by using following code

Document doc = new Document(filePath);
// Updates word count properties of the document.
// getting document properties.

I observed that the Aspose including the hidden properties count value but MS-Word excluding those value that’s the reason getting difference in count. I need to know how can i get the count equals to the MS-Word count values(excluding those hidden properties count) using aspose. please suggest me.

Attached :

  • document(wrongCount.rtf),
  • image which shows the MS-Word count values(wrongCount.png) and
  • image which shows the hidden properties(hiddenProperties.png).

Need quick response.


Hi Kapil,

Thanks for your inquiry.
To mimic the MS
Word behaviour, I have logged this issue as WORDSNET-10419. We will
update you via this forum thread once this issue is resolved. We
apologize for your inconvenience.

As a workaround of this issue, please use the following code example. Hope this helps you.

Document doc = new Document(MyDir + "wrongCount.rtf");
for (Run run : (Iterable) doc.getChildNodes(NodeType.RUN, true)){
// Updates word count properties of the document.
System.out.println("Words : " + doc.getBuiltInDocumentProperties().getWords());
System.out.println("Paragraphs : " + doc.getBuiltInDocumentProperties().getParagraphs());
System.out.println("CharactersWithSpaces : " + doc.getBuiltInDocumentProperties().getCharactersWithSpaces());
System.out.println("Characters : " + doc.getBuiltInDocumentProperties().getCharacters());

Hi Tahir,
Thanks for your response, the solution worked for me. I hope this bug resolves in feature releases of Aspose instead of adding extra code .


Hi Kapil,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. We will update you via this forum thread once WORDSNET-10419 issue is resolved.

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

The issues you have found earlier (filed as WORDSNET-10419) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.