Package org.docx4j

Examples of org.docx4j.TraversalUtil


    // Empty the content
        // .. OpenDoPEIntegrity fixes this where it is not OK, but
        // where it needs to insert a tc, it has no way of adding original tcPr, so
        // we handle this 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);     
View Full Code Here


    for (int i = 0; i < repeated.size(); i++) {

      log.info("\n Traversing clone " + i);

      dt.index = i;
      new TraversalUtil(repeated.get(i), dt);
    }
    log.info(".. deep traversals done ");
   
    // make bookmarks (if any) unique
    for (int i = 0; i < repeated.size(); i++) {
View Full Code Here

    // Empty the content
        // .. OpenDoPEIntegrity fixes this where it is not OK, but
        // where it needs to insert a tc, it has no way of adding original tcPr, so
        // we handle this 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);
View Full Code Here

        shell.getContent().addAll(contentList);
        Body shellClone = (Body) XmlUtils.deepCopy(shell);

        // find fields
        ComplexFieldLocator fl = new ComplexFieldLocator();
        new TraversalUtil(shellClone, fl);
        log.info("Found " + fl.getStarts().size() + " fields ");

        // canonicalise and setup fieldRefs
        List<FieldRef> fieldRefs = new ArrayList<FieldRef>();
    canonicaliseStarts(fl, fieldRefs);
View Full Code Here

    shell.getContent().addAll(contentList);
    Body shellClone = (Body)XmlUtils.deepCopy(shell);
   
    // find fields
    ComplexFieldLocator fl = new ComplexFieldLocator();
    new TraversalUtil(shellClone, fl);
    log.info("Found " + fl.getStarts().size() + " fields ");
   
   
    // canonicalise and setup fieldRefs
    List<FieldRef> fieldRefs = new ArrayList<FieldRef>();
View Full Code Here

  private int initBookmarkIdStart() {

    int highestId = 0;
   
    RangeFinder rt = new RangeFinder("CTBookmark", "CTMarkupRange");
    new TraversalUtil(wordMLPackage.getMainDocumentPart().getContent(), rt);
   
    for (CTBookmark bm : rt.getStarts()) {
     
      BigInteger id = bm.getId();
      if (id!=null && id.intValue()>highestId) {
View Full Code Here

  protected void fixRange(List<Object> paragraphs, String startElement,
      String endElement, String refElement, long global, int instanceNumber) throws Exception {
       
    RangeTraverser rt = new RangeTraverser(startElement, endElement,
        refElement);
    new TraversalUtil(paragraphs, rt);

    Method startIdMethod = null;
    Method endIdMethod = null;
   
   
View Full Code Here

    this.xPathsPart = xPathsPart;
   
    Object clone = XmlUtils.deepCopy(part.getJaxbElement());
   
    BindingTraversor bt = new BindingTraversor();
    new TraversalUtil(clone, bt);
   
    return clone;
  }
View Full Code Here

     
//      <w:drawing>
//      <wp:inline distT="0" distB="0" distL="0" distR="0">
//        <wp:extent cx="3238500" cy="2362200" />   
      ExtentFinder ef = new ExtentFinder();
      new TraversalUtil(sdt.getSdtContent().getContent(), ef);
     
      sdtParent = XmlUtils.unwrap(sdtParent);
      //System.out.println("sdt's parent: " + sdtParent.getClass().getName() );
     
      // TODO: remove any images in package which are no longer used.
View Full Code Here

        // do that first, since it creates virtual styles for DocDefaults,
        // which we need to include in the below
        styleRenamer.setStyles(styles);
       
    try {
      new TraversalUtil(wmlPackage.getMainDocumentPart().getContents(), styleRenamer);
    } catch (Docx4JException e) {
      // TODO Auto-generated catch block
      log.error(e.getMessage(), e);
    }
   
View Full Code Here

TOP

Related Classes of org.docx4j.TraversalUtil

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.