I need to identify bulleted (and numbered) lists in a document. Numbered lists are easy enough:
- Code: Select all
org.docx4j.wml.PPr ppr = ((org.docx4j.wml.P)o).getPPr(); // get paragraph propertires
PPrBase.NumPr numPr = ppr.getNumPr();
if( numPr != null) { // This paragraph is numbered
System.out.println("This paragraph has numbering level: " + numPr.getIlvl().getVal());
}
The XML for bulleted list item looks like this:
- Code: Select all
<w:p>
<w:pPr>
<w:listPr><w:ilvl w:val="0"/><!--skip-->
</w:listPr>
</w:pPr>
<w:r><w:t>Bulleted item 1</w:t></w:r>
</w:p>
I expected that I could do something like
- Code: Select all
listPr = ppr.getListPr()
Is there any way around it, i.e. getting all XML children of ppr and finding <w:listPr> element?