Page 1 of 1

Numbering in docx

PostPosted: Wed Apr 03, 2013 11:08 pm
by eltayeb
if i have document like that

1. Ahmed
3. dsdad
8. hhhhh
9. ddsjuhds
10. shssh
4. Eltayeb
2. Trying something new gg
3. hhh

• Bullet1
• Bullet2

1. Number1
2. Number2

• Bull1
• Bull2


i try to use
Code: Select all
((org.docx4j.wml.P) o).getPPr().getNumPr()


but i cant know what info will make me see numbering as showed in document

Re: Numbering in docx

PostPosted: Thu Apr 04, 2013 7:36 am
by jason
See https://github.com/plutext/docx4j/blob/ ... nXSLT.java at line 168:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                        // Numbering
                        String numberText=null;
                        String numId=null;
                        String levelId=null;
                        if (pPr.getNumPr()!=null) {
                                numId = pPr.getNumPr().getNumId()==null ? null : pPr.getNumPr().getNumId().getVal().toString();
                                levelId = pPr.getNumPr().getIlvl()==null ? null : pPr.getNumPr().getIlvl().getVal().toString();
                        }
                       
                ResultTriple triple = org.docx4j.model.listnumbering.Emulator.getNumber(
                                conversionContext.getWmlPackage(), pStyleVal, numId, levelId);  
               

                        if (triple==null) {
                        log.debug("computed number ResultTriple was null");
                } else {
                                if (triple.getBullet() != null) {
                                        //numberText = (triple.getBullet() + " ");
                                        numberText = "\u2022  ";
                                } else if (triple.getNumString() == null) {
                                        log.error("computed NumString was null!");
                                        numberText = ("?");
                                } else {
                                        numberText = (triple.getNumString() + " ");
                                }
                }
 
Parsed in 0.022 seconds, using GeSHi 1.0.8.4


Note that the numbering information can be in the w:pPr, or it could be in the paragraph style. Emulator.getNumber checks there, and calculates the actual number.

Re: Numbering in docx

PostPosted: Sun Apr 07, 2013 7:55 pm
by eltayeb
Thanks jason it works correctly

i think it should be added in the documentation