Package org.docx4j.wml.PPrBase

Examples of org.docx4j.wml.PPrBase.NumPr


          if (s.getPPr()==null || s.getPPr().getNumPr()==null) {
            log.warn("For w:numStyleLink, style " + numStyleId + " has no w:numPr");
            continue;           
          }
         
          NumPr styleNumPr = s.getPPr().getNumPr();
         
          // Get the concrete list this point to
          if (styleNumPr.getNumId()==null) {
            log.warn("For w:numStyleLink, style " + numStyleId + " w:numPr has no w:numId");
            continue;                       
          }
          BigInteger concreteListId = styleNumPr.getNumId().getVal();
         
          // Get the target abstract num
          ListNumberingDefinition lnd = getInstanceListDefinitions().get(concreteListId.toString());
          if (lnd==null) {
            log.warn("No ListNumberingDefinition entry with ID " + concreteListId.toString());
View Full Code Here


             
            return null;
        }

       
        NumPr numPr = ppr.getNumPr();
       
        if (numPr==null) {
            log.debug("Couldn't get NumPr from " +  pStyleVal);
//            log.debug(
//                org.docx4j.XmlUtils.marshaltoString(style, true, true)
//                );
            // So there is no numbering set on the style either
            // That's ok ..
            return null;
        }
       
        if (numPr.getNumId()==null) {
          log.error("numId was null!");
          return null;         
        }
       
        numId = numPr.getNumId().getVal().toString();
        if (numId.equals("")) {
          log.error("numId was empty!");
          return null;
        }
       
        if (levelId == null
            || levelId.equals("") ) {
         
          if (numPr.getIlvl() != null ) {
           
            levelId = numPr.getIlvl().getVal().toString();
              log.info("levelId=" + levelId + " (from style)" );
          } else {
            // default
            levelId = "0";
          }
View Full Code Here

             
            return null;
        }

       
        NumPr numPr = style.getPPr().getNumPr();
       
        if (numPr==null) {
            log.debug("Couldn't get NumPr from " +  pStyleVal);
//            log.debug(
//                org.docx4j.XmlUtils.marshaltoString(style, true, true)
//                );
            // So there is no numbering set on the style either
            // That's ok ..
            return null;
        }
       
       
        if (numPr.getNumId()==null) {
          log.debug("NumPr element has no numId");
          if (pStyleVal==null) {
            return null;
          } else {
                // use propertyResolver to follow <w:basedOn w:val="blagh"/>
              log.debug(pStyleVal + ".. use propertyResolver to follow basedOn");
            PPr ppr = propertyResolver.getEffectivePPr(pStyleVal);
           
            numPr = ppr.getNumPr();
              if (numPr==null) { 
                  log.debug(pStyleVal + "NumPr element still has no numId (basedOn didn't help)");
                return null; // Is this the right thing to do? Check!
              } else {               
                log.info("Got numId: " + numPr.getNumId() );
              }
           
          }
         
        }
       
        if (numPr.getNumId()==null) {
          log.error("numId was null!");
          return null;         
        }
       
        numId = numPr.getNumId().getVal().toString();
        if (numId.equals("")) {
          log.error("numId was empty!");
          return null;
        }
       
        if (levelId == null
            || levelId.equals("") ) {
         
          if (numPr.getIlvl() != null ) {
           
            levelId = numPr.getIlvl().getVal().toString();
              log.info("levelId=" + levelId + " (from style)" );
          } else {
            // default
            levelId = "0";
          }
View Full Code Here

      if (o instanceof P) {
       
        paragraph = (P)o;       
        PPr ppr = propertyResolver.getEffectivePPr(paragraph.getPPr());
       
        NumPr numPr = ppr.getNumPr();
       
        if (numPr==null) {
          closeAllLists();
          resultElts.add(o);
          continue;
        }
       
        /* It is numbered.
         *
         * Cases:
         *
         * - no current list
         *
         * - same list, same level
         *
         * - same list, different level
         *
         * - different list
         *
         *
         * If a list item uses the same list but is a different
         * level, we'll push/pop levels as appropriate.
         *
         * This implies that when we start, we'll push levels
         * to get to the right starting level.
         *
         * If its a different list, we'll pop all levels, and
         * start again.
         *
         * TODO: consider what styling to attach to the OL|UL.
         * We should match the ImportXHTML behaviour.
         *
         */
       
        BigInteger numId = numPr.getNumId().getVal();
       
        BigInteger ilvl = null;
        if (numPr.getIlvl()==null) {
          ilvl = BigInteger.ZERO;
        } else {
          ilvl = numPr.getIlvl().getVal();
        }
       
        ListSpec listSpec = listStack.peek();
        if (listSpec==null
            || (numId!=null
View Full Code Here

           
      org.docx4j.wml.PPr ppr = factory.createPPr();     
      p.setPPr( ppr );
     
      // Create and add <w:numPr>
      NumPr numPr =  factory.createPPrBaseNumPr();
      ppr.setNumPr(numPr);
     
      // The <w:ilvl> element
      Ilvl ilvlElement = factory.createPPrBaseNumPrIlvl();
      numPr.setIlvl(ilvlElement);
      ilvlElement.setVal(BigInteger.valueOf(ilvl));
           
      // The <w:numId> element
      NumId numIdElement = factory.createPPrBaseNumPrNumId();
      numPr.setNumId(numIdElement);
      numIdElement.setVal(BigInteger.valueOf(numId));
     
    return p;
   
  }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.PPrBase.NumPr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.