Q: How to get number from numbered list in Java Here i am using docx4j library. Here i am getting only text content not getting starting numbers. By using below code i am getting line number 18 for all lines, that is the main problem. Below is my word file text:-
 1. Correcting occlusion.
 2. Good nutrition.
 3. Conditioning of the  patient's musculature.

i. Correcting occlusion.
ii. Good nutrition.
iii. Conditioning of the  patient's musculature.

I am using this code to read list:-
 String className = textObject.getClass().getName();
 if(className.equals("org.docx4j.wml.Text")){
    String textContent = ((Text)textObject).getValue();
    System.out.println("TEXT: "+ textContent);
 }

This is the background xml for first two lines:-
 <w:p w14:textId="6086F6DA" w14:paraId="7BF78737" w:rsidRDefault="005304A8" w:rsidP="005304A8"
    w:rsidR="005304A8">
    <w:pPr>
        <w:pStyle w:val="1hd"/>
        <w:numPr>
            <w:ilvl w:val="0"/>
            <w:numId w:val="18"/>
        </w:numPr>
        <w:rPr>
            <w:lang w:eastAsia="en-IN" w:val="en-IN"/>
        </w:rPr>
    </w:pPr>
    <w:r w:rsidRPr="00747731">
        <w:rPr>
            <w:lang w:eastAsia="en-IN" w:val="en-IN"/>
        </w:rPr>
        <w:t>Correcting occlusion</w:t>
    </w:r>
    <w:r>
        <w:rPr>
            <w:lang w:eastAsia="en-IN" w:val="en-IN"/>
        </w:rPr>
        <w:t>.</w:t>
    </w:r>
</w:p>
<w:p w14:textId="07AC6E69" w14:paraId="6976D19F" w:rsidRDefault="005304A8" w:rsidP="005304A8"
    w:rsidR="005304A8">
    <w:pPr>
        <w:pStyle w:val="1hd"/>
        <w:numPr>
            <w:ilvl w:val="0"/>
            <w:numId w:val="18"/>
        </w:numPr>
        <w:rPr>
            <w:lang w:eastAsia="en-IN" w:val="en-IN"/>
        </w:rPr>
    </w:pPr>
    <w:r w:rsidRPr="00747731">
        <w:rPr>
            <w:lang w:eastAsia="en-IN" w:val="en-IN"/>
        </w:rPr>
        <w:t>Good nutrition</w:t>
    </w:r>
    <w:r>
        <w:rPr>
            <w:lang w:eastAsia="en-IN" w:val="en-IN"/>
        </w:rPr>
        <w:t>.</w:t>
    </w:r>
</w:p>

