Search in sources :

Example 1 with XWPFNum

use of org.apache.poi.xwpf.usermodel.XWPFNum in project tika by apache.

the class XWPFListManager method getFormattedNumber.

public String getFormattedNumber(BigInteger numId, int iLvl) {
    if (numbering == null || iLvl < 0 || numId == null) {
        return "";
    }
    int currNumId = numId.intValue();
    XWPFNum xwpfNum = numbering.getNum(numId);
    if (xwpfNum == null) {
        return "";
    }
    CTNum ctNum = xwpfNum.getCTNum();
    CTDecimalNumber abNum = ctNum.getAbstractNumId();
    int currAbNumId = abNum.getVal().intValue();
    ParagraphLevelCounter lc = listLevelMap.get(currAbNumId);
    LevelTuple[] overrideTuples = overrideTupleMap.get(currNumId);
    if (lc == null) {
        lc = loadLevelTuples(abNum);
    }
    if (overrideTuples == null) {
        overrideTuples = loadOverrideTuples(ctNum, lc.getNumberOfLevels());
    }
    String formattedString = lc.incrementLevel(iLvl, overrideTuples);
    listLevelMap.put(currAbNumId, lc);
    overrideTupleMap.put(currNumId, overrideTuples);
    return formattedString;
}
Also used : CTNum(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNum) CTDecimalNumber(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber) XWPFNum(org.apache.poi.xwpf.usermodel.XWPFNum)

Aggregations

XWPFNum (org.apache.poi.xwpf.usermodel.XWPFNum)1 CTDecimalNumber (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber)1 CTNum (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNum)1