Duplicated paragraph nodes are returned by Document.getChildNodes using Java


I want to count paragraphs with this code (JAVA) :

int nParagraph=0;
com.aspose.words.NodeCollection children = doc.getChildNodes(com.aspose.words.NodeType.PARAGRAPH, true);
for (com.aspose.words.Paragraph paragraph : (Iterable<com.aspose.words.Paragraph>) children) {
if (!StringUtils.isEmpty(paragraph.getText())) {
System.out.println(":::::COUNT PARAGRAPH:::::"+nParagraph);
System.out.println(":::::COUNT PARAGRAPH:::::"+doc.getChildNodes(com.aspose.words.NodeType.PARAGRAPH, true).getCount());

And the results are not equal to MS-Word. I found that because it include empty paragraphs, I handled this issue by filter empty paragraphs out, and there are duplicated paragraphs as attached pictures.
Is there a way to fix the duplicated paragraph? Please advise.


Screenshot from 2020-08-14 16-43-31.png (23.5 KB)
Screenshot from 2020-08-14 17-14-59.png (50.2 KB)
sample.zip (136.6 KB)


While using latest version of Aspose.Words for Java 20.8, we have not found the duplicate paragraph issue. Could you please share some more detail about your query? We will then provide you more information on it.

Sorry for late reply, I switch to other project. My project using Aspose.words 19.6. I tried to use version 20.8 but the result is same.


Please make sure that you are using the same document and code example. Could you please share the screenshot of input document (paragraph) that is duplicated by Aspose.Words? We will investigate this issue further and provide you more information on it.