How to determine if the text is in a bulleted/numbered list?

Hello Team,
How to determine if the text is in a bulleted/numbered list?

For example, “1234” is in a numbered list

demo (1).docx (13.8 KB)

@Doraemon To achieve this it is simply required to get paragraph where the required text is located. You can achieve this using the same approach as suggested in another your thread. Once you get Run node that contains the text, you can get it’s paragraph and check whether the paragraph is list item:

Paragraph parentPara = run.getAncestor(NodeType.PARAGRAPH);
System.out.println(parentPara.isListItem());

@alexey.noskov
Thank you for your help. That’s exactly what i want.

1 Like