Examples of PPr


Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE);

    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_in_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE)// table style should get overridden
 
    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE);

    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_in_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE)// table style should get overridden
 
    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE);

    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_in_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE);

    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE);

    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
View Full Code Here

Examples of org.docx4j.wml.PPr

//      System.out.println(i);
     
      P p = (P)document.getContent().get(i);
     
      PPr pPr = p.getPPr();
      RPr rPr = ((R)p.getContent().get(0)).getRPr();
     
      Text wmlText = (Text)XmlUtils.unwrap(((R)p.getContent().get(0)).getContent().get(0));
     
      log.debug(wmlText.getValue());
View Full Code Here

Examples of org.docx4j.wml.PPr

            log.debug("no explicit numId; no style either");
          return null;
        }
       
        log.debug("no explicit numId; looking in styles");
      PPr ppr = propertyResolver.getEffectivePPr(pStyleVal);
     
        if (ppr == null) {
            log.debug("Style '" + pStyleVal + "' has no pPr");
//            System.out.println("Style '" + pStyleVal + "' has no pPr");
//              System.out.println(
//                  org.docx4j.XmlUtils.marshaltoString(style, true, true)
//                  );
             
            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";
          }
        }
      }

    log.debug("Using numId: " + numId);       
     
    if (levelId == null || levelId.equals("")) {
      // String numId = getAttributeValue(numIdNode, ValAttrName);
      log.warn("No level id?! Default to 0.");
      levelId="0";
    }


    if (numberingPart.getInstanceListDefinitions().containsKey(numId)
        && numberingPart.getInstanceListDefinitions().get(numId).LevelExists(
            levelId)) {

      numberingPart.getInstanceListDefinitions().get(numId).IncrementCounter(
          levelId);
      triple.numString = numberingPart.getInstanceListDefinitions().get(numId)
          .GetCurrentNumberString(levelId);
     
      log.debug("Got number: " + triple.numString);

      String font = numberingPart.getInstanceListDefinitions().get(numId)
          .GetFont(levelId);

      if (font != null && !font.equals("")) {
        triple.numFont = font;
      }

      if (numberingPart.getInstanceListDefinitions().get(numId).IsBullet(levelId)) {
        //triple.isBullet = true;
        triple.bullet = numberingPart.getInstanceListDefinitions().get(numId).getLevel(levelId).getLevelText();
      }
     
      triple.lvl = numberingPart.getInstanceListDefinitions().get(numId).getLevel(levelId).getJaxbAbstractLvl();
     
      PPr ppr = triple.getLvl().getPPr();
      if (ppr!=null) {
        triple.ind = ppr.getInd();
      }
     
      triple.rPr = triple.getLvl().getRPr();
     
    } else if (!numberingPart.getInstanceListDefinitions().containsKey(numId)){
View Full Code Here

Examples of org.docx4j.wml.PPr

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

    log.debug("Using numId: " + numId);       
     
    if (levelId == null || levelId.equals("")) {
      // String numId = getAttributeValue(numIdNode, ValAttrName);
      log.warn("No level id?! Default to 0.");
      levelId="0";
    }


    if (numberingPart.getInstanceListDefinitions().containsKey(numId)
        && numberingPart.getInstanceListDefinitions().get(numId).LevelExists(
            levelId)) {

      // don't IncrementCounter here
     
      Lvl lvl = numberingPart.getInstanceListDefinitions().get(numId).getLevel(levelId).getJaxbAbstractLvl();
      PPr ppr = lvl.getPPr();
     
      if (ppr==null) {
        return null;
      } else {
        return ppr.getInd();
      }
     
    }
    return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.