Package org.docx4j.wml

Examples of org.docx4j.wml.FldChar


             
              // For top level fields only, we add this
              log.debug(".. ADDING SEP ..  ");
 
  //            R separateR = Context.getWmlObjectFactory().createR();             
              FldChar fldChar = Context.getWmlObjectFactory().createFldChar();
              fldChar.setFldCharType(STFldCharType.SEPARATE);
              newR.getContent().add(fldChar);
                         
              if (!newAttachPoint.getContent().contains(newR)) {
                newAttachPoint.getContent().add(newR);
                log.debug("-- attaching -->" + XmlUtils.marshaltoString(newR, true, true));
View Full Code Here


  public static boolean isCharType(Object o2, STFldCharType charType) {
   
    o2 = XmlUtils.unwrap(o2);
   
    if (o2 instanceof org.docx4j.wml.FldChar) {
      FldChar fldChar = (FldChar)o2;
      if (fldChar.getFldCharType().equals(charType) ) {
               
        return true;
      } else {
        log.debug(fldChar.getFldCharType().toString());       
      }
    }
    return false;
 
View Full Code Here

//    if (o instanceof P) {
//      currentP = (P)o;
//    }
   
    if (o instanceof org.docx4j.wml.FldChar) {
      FldChar fldChar = (FldChar)o;
      if (fldChar.getFldCharType().equals(STFldCharType.BEGIN) ) {
        //System.out.println("Found a BEGIN");
        depth++;
        P currentP = pStack.peek();
        if (depth==1 && !starts.contains(currentP)) {
          starts.add(currentP);
//          System.out.println("Adding " + XmlUtils.marshaltoString(currentP));
        }
      }
      if (fldChar.getFldCharType().equals(STFldCharType.END) ) {
        depth--;
      }
    }
   
    return null;
View Full Code Here

          </w:r>
        </w:p>         */       
        P paragraphForTOC = factory.createP();          
        R r = factory.createR();

        FldChar fldchar = factory.createFldChar();
        fldchar.setFldCharType(STFldCharType.BEGIN);
        fldchar.setDirty(true);
        r.getContent().add(getWrappedFldChar(fldchar));
        paragraphForTOC.getContent().add(r);

        R r1 = factory.createR();
        Text txt = new Text();
        txt.setSpace("preserve");
        txt.setValue("TOC \\o \"1-3\" \\h \\z \\u \\h");
        r.getContent().add(factory.createRInstrText(txt) );
        paragraphForTOC.getContent().add(r1);

        FldChar fldcharend = factory.createFldChar();
        fldcharend.setFldCharType(STFldCharType.END);
        R r2 = factory.createR();
        r2.getContent().add(getWrappedFldChar(fldcharend));
        paragraphForTOC.getContent().add(r2);
           
    body.getContent().add(paragraphForTOC);
View Full Code Here

      }
      return artificialList;
    } else if (o instanceof org.docx4j.dml.CTGvmlGroupShape) {
      return ((org.docx4j.dml.CTGvmlGroupShape)o).getTxSpOrSpOrCxnSp();
    } else if(o instanceof FldChar) {
      FldChar fldChar = ((FldChar)o);
      List<Object> artificialList = new ArrayList<Object>();
      artificialList.add(fldChar.getFldCharType());
      if(fldChar.getFfData() != null) {
        artificialList.add(fldChar.getFfData());
      }
      if(fldChar.getFldData() != null) {
        artificialList.add(fldChar.getFldData());
      }
      if(fldChar.getNumberingChange() != null) {
        artificialList.add(fldChar.getNumberingChange());
      }
      return artificialList;
    }

    // OK, what is this? Use reflection ..
View Full Code Here

    // Create object for r
      R r = wmlObjectFactory.createR();
      p.getContent().add( r);
          // Create object for fldChar (wrapped in JAXBElement)
          FldChar fldchar = wmlObjectFactory.createFldChar();
          JAXBElement<org.docx4j.wml.FldChar> fldcharWrapped = wmlObjectFactory.createRFldChar(fldchar);
          r.getContent().add( fldcharWrapped);
              fldchar.setFldCharType(org.docx4j.wml.STFldCharType.BEGIN);
          // Create object for instrText (wrapped in JAXBElement)
          Text text = wmlObjectFactory.createText();
          JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRInstrText(text);
          r.getContent().add( textWrapped);
              text.setValue( instrText);
              text.setSpace( "preserve");  

          // Create object for fldChar (wrapped in JAXBElement)
          fldchar = wmlObjectFactory.createFldChar();
          fldcharWrapped = wmlObjectFactory.createRFldChar(fldchar);
          r.getContent().add( fldcharWrapped);
              fldchar.setFldCharType(org.docx4j.wml.STFldCharType.END);
   
  }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.FldChar

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.