如何从Java编号列表中获取编号

时间:2017-05-10 06:54:07

标签: java docx docx4j

这里我使用的是docx4j库。在这里,我只得到文本内容没有得到起始数字。通过使用下面的代码我得到所有行的第18行,这是主要问题。以下是我的文字文字: -

 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.

我正在使用此代码阅读列表: -

 String className = textObject.getClass().getName();
 if(className.equals("org.docx4j.wml.Text")){
    String textContent = ((Text)textObject).getValue();
    System.out.println("TEXT: "+ textContent);
 }

这是前两行的背景xml: -

 <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>

0 个答案:

没有答案
相关问题