Package org.docx4j.wml

Examples of org.docx4j.wml.PPr


            + docDefaultsString, e);
      }
    }

    // Setup documentDefaultPPr
    PPr documentDefaultPPr;
    if (docDefaults.getPPrDefault() == null) {
      log.warn("No PPrDefault present");
      try {
        documentDefaultPPr = (PPr) XmlUtils
            .unmarshalString(pPrDefaultsString);
      } catch (JAXBException e) {
        throw new Docx4JException("Problem unmarshalling "
            + pPrDefaultsString, e);
      }

    } else {
      documentDefaultPPr = docDefaults.getPPrDefault().getPPr();
      if (documentDefaultPPr==null) {
        documentDefaultPPr = Context.getWmlObjectFactory().createPPr();
      }
    }
   
    // If the docDefaults have no setting for w:spacing
    // then add it:
    if (documentDefaultPPr.getSpacing()==null) {
      Spacing spacing = Context.getWmlObjectFactory().createPPrBaseSpacing();
      documentDefaultPPr.setSpacing(spacing);
      spacing.setBefore(BigInteger.ZERO);
      spacing.setAfter(BigInteger.ZERO);
      spacing.setLine(BigInteger.valueOf(240));
    }
View Full Code Here


        p.setParaId(uuid);
        p.setTextId(uuid);
      }
     
      // For W15, collapse
      PPr ppr = p.getPPr();
      if (ppr==null) {
        ppr = Context.getWmlObjectFactory().createPPr();
        p.setPPr(ppr);
      }
      if (ppr.getCollapsed()==null) {
        BooleanDefaultTrue notCollapsed = new BooleanDefaultTrue();
        notCollapsed.setVal(Boolean.FALSE);
        ppr.setCollapsed(notCollapsed);
      }
    }
   
    return "w14 w15";
     
View Full Code Here

        if (p.getParaId()!=null) {
          needW14 = true;
        }
        // W15?
        if (!needW15) {
          PPr ppr = p.getPPr();
          if (ppr!=null) {
            if (ppr.getCollapsed()!=null) {
              needW15 = true;           
            }
           
            if (ppr.getSectPr()!=null
                && ppr.getSectPr().getFootnoteColumns()!=null) {
              needW15 = true;                         
            }
          }
        }
       
View Full Code Here

        P p = (P)o;

        if (p.getPPr()!=null) {

            PPr pPr = propertyResolver.getEffectivePPr(p.getPPr());

            if (pPr.getInd()!=null) {

              String actual = removeNamespaces(XmlUtils.marshaltoString(pPr.getInd(), true));

              Text text = (Text)XmlUtils.unwrap(
                  ((R)p.getContent().get(0)).getContent().get(0));
              String content = text.getValue();
View Full Code Here

    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

    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

  protected P createNumberedP(String style, int numId, int ilvl) {
   
    P p = wmlObjectFactory.createP();
        // Create object for pPr
        PPr ppr = wmlObjectFactory.createPPr();
        p.setPPr(ppr);
       
        if (numId>-1) {
            // Create object for numPr
            PPrBase.NumPr pprbasenumpr = wmlObjectFactory.createPPrBaseNumPr();
            ppr.setNumPr(pprbasenumpr);
                // Create object for ilvl
                PPrBase.NumPr.Ilvl pprbasenumprilvl = wmlObjectFactory.createPPrBaseNumPrIlvl();
                pprbasenumpr.setIlvl(pprbasenumprilvl);
                    pprbasenumprilvl.setVal( BigInteger.valueOf( ilvl) );
                // Create object for numId
                PPrBase.NumPr.NumId pprbasenumprnumid = wmlObjectFactory.createPPrBaseNumPrNumId();
                pprbasenumpr.setNumId(pprbasenumprnumid);
                    pprbasenumprnumid.setVal( BigInteger.valueOf( numId) );
        }
            // Create object for pStyle
            PPrBase.PStyle pprbasepstyle = wmlObjectFactory.createPPrBasePStyle();
            ppr.setPStyle(pprbasepstyle);
                pprbasepstyle.setVal( style);
        // Create object for r
        R r = wmlObjectFactory.createR();
        p.getContent().add( r);
            // Create object for t (wrapped in JAXBElement)
View Full Code Here

    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

    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

    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

TOP

Related Classes of org.docx4j.wml.PPr

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.