Package org.docx4j.wml

Examples of org.docx4j.wml.Text


            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();

              // If contains [expect] [/expect], then test for this
              // Since attributes can be in any order, work on an
              // attribute by attribute basis.
              if (content.indexOf(EXPECT_START)>=0) {
View Full Code Here


                pprbasepstyle.setVal( style);
        // Create object for r
        R r = wmlObjectFactory.createR();
        p.getContent().add( r);
            // Create object for t (wrapped in JAXBElement)
            Text text = wmlObjectFactory.createText();
            JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRT(text);
            r.getContent().add( textWrapped);
                text.setValue( style + "; list " + numId + ", ilvl " + ilvl);

    return p;
    }
View Full Code Here

   
    P p = wmlObjectFactory.createP();
        R r = wmlObjectFactory.createR();
        p.getContent().add( r);
            // Create object for t (wrapped in JAXBElement)
            Text text = wmlObjectFactory.createText();
            JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRT(text);
            r.getContent().add( textWrapped);
                text.setValue( "UnnumberedP");

    return p;
   
View Full Code Here

            }
          }
         
          ResultTriple rt = Emulator.getNumber(wordMLPackage, pStyleVal, numId, levelId);
         
          Text text = (Text)XmlUtils.unwrap(
              ((R)p.getContent().get(0)).getContent().get(0));
          String content = text.getValue();
         
          // If contains [expect] [/expect], then test for this
          if (content.contains(EXPECT_START)) {
            int start = content.indexOf(EXPECT_START) + EXPECT_START.length();
            int end = content.indexOf(EXPECT_END);
View Full Code Here

    CTSdtContentRun sdtContent = Context.getWmlObjectFactory().createCTSdtContentRun();     
    sdtRun.setSdtContent(sdtContent);

    R rnew = new R();
    rnew.setRPr( rPr ); // point at old rPr, if any
    Text text = Context.getWmlObjectFactory().createText();
    text.setValue(key);
    rnew.getContent().add(text);
   
    sdtContent.getContent().add(rnew);
  }
View Full Code Here

           
            if (currentT==null) { // first object, or after something not a w:t
              currentT=(JAXBElement)rc;
              newRunContents.add(currentT);
            } else {
              Text currentText = (Text)XmlUtils.unwrap(currentT);
              String val = currentText.getValue();
             
              currentText.setValue(val + ((Text)XmlUtils.unwrap(rc)).getValue() );               
            }
           
            // <w:t xml:space="preserve">
            if (((Text)XmlUtils.unwrap(rc)).getSpace()!=null
                && ((Text)XmlUtils.unwrap(rc)).getSpace().equals("preserve")) { // any of them
View Full Code Here

   private void addTextRun(R r, String val, List<Object> replacementContent) {
    
      R rnew = new R();
      rnew.setRPr( r.getRPr() ); // point at old rPr, if any
     
      Text text = Context.getWmlObjectFactory().createText();
      text.setValue(val);
      if (val.startsWith(" ")
          || val.endsWith(" ") ) {
        text.setSpace("preserve");
      }
     
      rnew.getContent().add(text);
      replacementContent.add(rnew);
    
View Full Code Here

    assertTrue(xml.contains("<w:bookmarkEnd"));
   
    // result slot contents
    FieldRef fieldRef1 =  fieldRefs.get(0);
    R r = fieldRef1.getResultsSlot();
    Text text = (Text)XmlUtils.unwrap(r.getContent().get(0));
    assertTrue(text.getValue().equals("(Customer)"));
   
  }
View Full Code Here

      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());
     
      DocumentFragment df = (DocumentFragment)result;
View Full Code Here

         
          String oldName = ((CTBookmark)o).getName();
          String newName = oldName + "_" + instanceNumber ; // can't start with a number
          ((CTBookmark)o).setName(newName);
          for (Object ref : rt.refs) {
            Text fieldInstr = (Text)ref;
            String fieldVal = fieldInstr.getValue();
            if (fieldVal.contains("REF ")
                && fieldVal.contains(" " + oldName + " ") ) {
              fieldInstr.setValue(fieldVal.replace(oldName, newName));
            }
          }
        }

        // find the closing point tag
View Full Code Here

TOP

Related Classes of org.docx4j.wml.Text

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.