org.apache.poi.xwpf.usermodel.XWPFNumbering.getNum()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(316)

本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFNumbering.getNum()方法的一些代码示例,展示了XWPFNumbering.getNum()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFNumbering.getNum()方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFNumbering
类名称:XWPFNumbering
方法名:getNum

XWPFNumbering.getNum介绍

[英]get Num by NumID
[中]通过NumID获取Num

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
   * return the abstractNumID
   * If the AbstractNumID not exists
   * return null
   *
   * @param numID
   * @return abstractNumID
   */
  public BigInteger getAbstractNumID(BigInteger numID) {
    XWPFNum num = getNum(numID);
    if (num == null)
      return null;
    if (num.getCTNum() == null)
      return null;
    if (num.getCTNum().getAbstractNumId() == null)
      return null;
    return num.getCTNum().getAbstractNumId().getVal();
  }
}

代码示例来源:origin: org.apache.poi/poi-ooxml

XWPFNumbering numbering = document.getNumbering();
if (numID != null && numbering != null) {
  XWPFNum num = numbering.getNum(numID);

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Returns numbering format for this paragraph, eg bullet or
 * lowerLetter.
 * Returns null if this paragraph does not have numeric style.
 */
public String getNumFmt() {
  BigInteger numID = getNumID();
  XWPFNumbering numbering = document.getNumbering();
  if (numID != null && numbering != null) {
    XWPFNum num = numbering.getNum(numID);
    if (num != null) {
      BigInteger ilvl = getNumIlvl();
      BigInteger abstractNumId = num.getCTNum().getAbstractNumId().getVal();
      CTAbstractNum anum = numbering.getAbstractNum(abstractNumId).getAbstractNum();
      CTLvl level = null;
      for (int i = 0; i < anum.sizeOfLvlArray(); i++) {
        CTLvl lvl = anum.getLvlArray(i);
        if (lvl.getIlvl().equals(ilvl)) {
          level = lvl;
          break;
        }
      }
      if (level != null && level.getNumFmt() != null
          && level.getNumFmt().getVal() != null) {
        return level.getNumFmt().getVal().toString();
      }
    }
  }
  return null;
}

代码示例来源:origin: org.apache.poi/poi-ooxml

XWPFNumbering numbering = document.getNumbering();
if (numID != null && numbering != null) {
  XWPFNum num = numbering.getNum(numID);
  if (num != null) {
    BigInteger ilvl = getNumIlvl();

代码示例来源:origin: apache/tika

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

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core

protected XWPFNum getXWPFNum( CTNumPr numPr )
{
  CTDecimalNumber numID = numPr.getNumId();
  if ( numID == null )
  {
    // numID can be null, ignore the numbering
    // see https://code.google.com/p/xdocreport/issues/detail?id=239
    return null;
  }
  XWPFNum num = document.getNumbering().getNum( numID.getVal() );
  return num;
}

代码示例来源:origin: com.github.livesense/org.liveSense.framework.xdocreport

protected XWPFNum getXWPFNum( CTNumPr numPr )
{
  CTDecimalNumber numID = numPr.getNumId();
  if ( numID == null )
  {
    // numID can be null, ignore the numbering
    // see https://code.google.com/p/xdocreport/issues/detail?id=239
    return null;
  }
  XWPFNum num = document.getNumbering().getNum( numID.getVal() );
  return num;
}

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core-gae

protected XWPFNum getXWPFNum( CTNumPr numPr )
{
  CTDecimalNumber numID = numPr.getNumId();
  if ( numID == null )
  {
    // numID can be null, ignore the numbering
    // see https://code.google.com/p/xdocreport/issues/detail?id=239
    return null;
  }
  XWPFNum num = document.getNumbering().getNum( numID.getVal() );
  return num;
}

代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-parsers

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

代码示例来源:origin: org.apache.tika/tika-parsers

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

代码示例来源:origin: stackoverflow.com

XWPFNum num = numbering.getNum(numId);
CTNumLvl lvloverride = num.getCTNum().addNewLvlOverride();
lvloverride.setIlvl(BigInteger.ZERO);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
   * return the abstractNumID
   * If the AbstractNumID not exists
   * return null
   *
   * @param numID
   * @return abstractNumID
   */
  public BigInteger getAbstractNumID(BigInteger numID) {
    XWPFNum num = getNum(numID);
    if (num == null)
      return null;
    if (num.getCTNum() == null)
      return null;
    if (num.getCTNum().getAbstractNumId() == null)
      return null;
    return num.getCTNum().getAbstractNumId().getVal();
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
   *return the abstractNumID
   *If the AbstractNumID not exists
   *return null
   * @param         numID
   * @return         abstractNumID
   */
  public BigInteger getAbstractNumID(BigInteger numID){
    XWPFNum num = getNum(numID);
    if(num == null)
      return null;
    if (num.getCTNum() == null)
      return null;
    if (num.getCTNum().getAbstractNumId() == null)
      return null;
    return num.getCTNum().getAbstractNumId().getVal();
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

XWPFNumbering numbering = document.getNumbering();
if (numID != null && numbering != null) {
  XWPFNum num = numbering.getNum(numID);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Returns numbering format for this paragraph, eg bullet or
 * lowerLetter.
 * Returns null if this paragraph does not have numeric style.
 */
public String getNumFmt() {
  BigInteger numID = getNumID();
  XWPFNumbering numbering = document.getNumbering();
  if (numID != null && numbering != null) {
    XWPFNum num = numbering.getNum(numID);
    if (num != null) {
      BigInteger ilvl = getNumIlvl();
      BigInteger abstractNumId = num.getCTNum().getAbstractNumId().getVal();
      CTAbstractNum anum = numbering.getAbstractNum(abstractNumId).getAbstractNum();
      CTLvl level = null;
      for (int i = 0; i < anum.sizeOfLvlArray(); i++) {
        CTLvl lvl = anum.getLvlArray(i);
        if (lvl.getIlvl().equals(ilvl)) {
          level = lvl;
          break;
        }
      }
      if (level != null && level.getNumFmt() != null
          && level.getNumFmt().getVal() != null) {
        return level.getNumFmt().getVal().toString();
      }
    }
  }
  return null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

XWPFNumbering numbering = document.getNumbering();
if (numID != null && numbering != null) {
  XWPFNum num = numbering.getNum(numID);
  if (num != null) {
    BigInteger ilvl = getNumIlvl();

相关文章