Package org.docx4j.wml

Examples of org.docx4j.wml.P


          // }

          // <w:r><w:rPr><w:rStyle
          // w:val="CommentReference"/></w:rPr><w:commentReference
          // w:id="0"/></w:r>
          P p = Context.getWmlObjectFactory().createP();
          R r = Context.getWmlObjectFactory().createR();
          p.getParagraphContent().add(r);

          R.CommentReference cr = Context.getWmlObjectFactory()
              .createRCommentReference();
          cr.setId( (BigInteger)id);
          r.getRunContent().add(cr);
View Full Code Here


      execute( wordMLPackage);
  }
 
  private static P createContent(String textContent) {
   
    P p = Context.getWmlObjectFactory().createP();

      R r = Context.getWmlObjectFactory().createR();
      p.getContent().add( r);
          // Create object for t (wrapped in JAXBElement)
          Text text = Context.getWmlObjectFactory().createText();
          JAXBElement<org.docx4j.wml.Text> textWrapped = Context.getWmlObjectFactory().createRT(text);
          r.getContent().add( textWrapped);
              text.setValue( textContent);
View Full Code Here

    PhysicalFonts.setRegex(regex);   

    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
    MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();
   
      P p = new P();
      mdp.getContent().add(p);
     
      R r = Context.getWmlObjectFactory().createR();
     
      r.getContent().add(
         
          // Absolute position to the right of column produces:

        // margin-left:108pt
        // mso-position-horizontal:absolute <------------
        // mso-position-horizontal-relative:text
          // mso-wrap-style:square

    // style="position:absolute;margin-left:108pt;margin-top:0;width:186.95pt;height:110.55pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:400;mso-height-percent:200;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:text;mso-width-percent:400;mso-height-percent:200;mso-width-relative:margin;mso-height-relative:margin;v-text-anchor:top"
          createPict(w10WrapEl, style,
              createContent("text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content text box content ")));

     
     
          // Relative position is done in percentages..

        //  mso-left-percent:600
        //  mso-position-horizontal-relative:left-margin-area
        //  mso-width-relative:margin
     
//      style="position:absolute;margin-left:0;margin-top:0;width:186.95pt;height:110.55pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:400;mso-height-percent:200;mso-left-percent:600;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal-relative:left-margin-area;mso-position-vertical:absolute;mso-position-vertical-relative:text;mso-width-percent:400;mso-height-percent:200;mso-left-percent:600;mso-width-relative:margin;mso-height-relative:margin;v-text-anchor:top"
     

     
      p.getContent().add( r);
     
      p.getContent().add(addFiller());
     
      return wordMLPackage;
   
  }
View Full Code Here

    RunFontSelector rfs = createRunFontSelector(wordMLPackage);
   
    // For each w:p, test w:r/w:t
    for (int i=0; i<document.getContent().size(); 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());
     
      Object result = rfs.fontSelector(pPr, rPr, wmlText);
//      System.out.println(result.getClass().getName());
View Full Code Here

            newSectPr.setType(type);

            ppr.setSectPr(newSectPr);
          } else {
            // Equally likely - its a table or something, so add a p
            P newP = Context.getWmlObjectFactory().createP();
            PPr ppr = Context.getWmlObjectFactory().createPPr();
            newP.setPPr(ppr);

            SectPr newSectPr = Context.getWmlObjectFactory()
                .createSectPr();
            SectPr.Type type = Context.getWmlObjectFactory()
                .createSectPrType();
View Full Code Here

    TcFinder tcFinder = new TcFinder();
    new TraversalUtil(((SdtElement)sdt).getSdtContent().getContent(), tcFinder);
    if (tcFinder.tcList.size()>0) {
      Tc tc = tcFinder.tcList.get(0);
      tc.getContent().clear();
      P p = Context.getWmlObjectFactory().createP();
      tc.getContent().add(p);     
          ((SdtElement)sdt).getSdtContent().getContent().clear();
          ((SdtElement)sdt).getSdtContent().getContent().add(tc);
    } else {
          ((SdtElement)sdt).getSdtContent().getContent().clear();
View Full Code Here

    TcFinder tcFinder = new TcFinder();
    new TraversalUtil(((SdtElement)sdt).getSdtContent().getContent(), tcFinder);
    if (tcFinder.tcList.size()>0) {
      Tc tc = tcFinder.tcList.get(0);
      tc.getContent().clear();
      P p = Context.getWmlObjectFactory().createP();
      tc.getContent().add(p);
          ((SdtElement)sdt).getSdtContent().getContent().clear();
          ((SdtElement)sdt).getSdtContent().getContent().add(tc);
    } else {
          ((SdtElement)sdt).getSdtContent().getContent().clear();
View Full Code Here

    RunFontSelector rfs = createRunFontSelector(wordMLPackage);
   
    // For each w:p, test w:r/w:t
    for (int i=0; i<document.getContent().size(); 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());
     
      Object result = rfs.fontSelector(pPr, rPr, wmlText);
//      System.out.println(result.getClass().getName());
View Full Code Here

    RunFontSelector rfs = createRunFontSelector(wordMLPackage);
   
    // For each w:p, test w:r/w:t
    for (int i=0; i<document.getContent().size(); 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());
     
      Object result = rfs.fontSelector(pPr, rPr, wmlText);
//      System.out.println(result.getClass().getName());
View Full Code Here

      log.debug(XmlUtils.marshaltoString(target.getMainDocumentPart().getJaxbElement(), true, true) );
     
      // add sectPr to final paragraph
      Object last = content.get( content.size()-1);
      P lastP = null;
      if (last instanceof P) {
        lastP = (P)last;
      } else {
        lastP = Context.getWmlObjectFactory().createP();
        target.getMainDocumentPart().getContent().add(lastP)
      }
      if (lastP.getPPr()==null) {
        lastP.setPPr(Context.getWmlObjectFactory().createPPr());       
      }
      SectPr thisSection = XmlUtils.deepCopy(documentSeparator);
      lastP.getPPr().setSectPr(thisSection);
     
      if (processHeadersAndFooters) {
        for( CTRel ctRel : hfTemplates.keySet()) {
         
          // Create a suitable part
View Full Code Here

TOP

Related Classes of org.docx4j.wml.P

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.