문제

when i use docx4j read a docx file

i want get the number of a list just like :

  1. something
  2. other

i can got the text "something" but i can't got the "1."

P p = (P) o;
PPr ppr = p.getPPr();
NumPr npr = ppr.getNumPr();
if(npr!=null){
    //how to parse npr...
}
List<Object> pl = p.getContent();
for (Object po : pl) {
    dealWithContent(po);
}

any one can tell me how to parse it?

도움이 되었습니까?

해결책

What you are asking is done by docx4j's HTML and PDF output.

Have a look at org.docx4j.model.listnumbering.Emulator, specifically its getNumber method

The emulator maintains internal counters for each list; if you invoke it for each paragraph in document order, then at any point in the document, the counters will reflect the current number of each list.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top