Hi,
I’m trying to identify the different elements of every lists available in a document.
The issue I face is that I actually can’t rely on the list id of a list.
The following code with the document attached always returns a list id of 1 even though there are actually two separate lists in this document.
Document document = new Document(“list id test.docx”);
NodeCollection paragraphs = document.getChildNodes(NodeType.PARAGRAPH, true);
for (Paragraph paragraph : paragraphs) {
if (!paragraph.isListItem()) {
continue;
}
System.out.print("List ID: " + paragraph.getListFormat().getList().getListId() + " Text: " + paragraph.toString(SaveFormat.TEXT));
}
Could you help me identifying the different lists in a document?
Thank you very much.
Best regards,