Package org.docx4j

Examples of org.docx4j.TraversalUtil


        parentNode.setAttribute("id", cssId);
      }
      document.appendChild(parentNode);
      generator = HTMLExporterVisitorGenerator.GENERATOR_FACTORY.
          createInstance(conversionContext, document, parentNode);
      new TraversalUtil(blockLevelContent, generator);
    return document;
 
View Full Code Here


   
   
    NodeList cellContents = content.getChildNodes(); // the w:tr
   
    TrFinder trFinder = new TrFinder();
    new TraversalUtil(tbl, trFinder);
   
    ensureFoTableBody(trFinder.trList); // this is currently applied to HTML etc as well
   
    int r = 0;
    for (Tr tr : trFinder.trList) {
View Full Code Here

    if (drawTableBorder) {
      drawTableBorder = (gridBefore == 0) && (gridAfter == 0);
    }
   
    TcFinder tcFinder = new TcFinder();
    new TraversalUtil(tr, tcFinder);
   
    //add dummy cell for gridBefore
    if (gridBefore > 0) {
      addDummyCell(gridBefore);
    }
View Full Code Here

      Set<ContentAccessor> partList = getParts(wordMLPackage);

      // Process repeats and conditionals.
      try {
        for (ContentAccessor part : partList) {
          new TraversalUtil(part, shallowTraversor);
        }
      } catch (InputIntegrityException iie) { // RuntimeException
        throw new Docx4JException(iie.getMessage(), iie);
      }
View Full Code Here

    List contentList = ((ContentAccessor)part).getContent();
    WordprocessingMLPackage wmlPackage = (WordprocessingMLPackage)part.getPackage();
   
    // find fields
    SimpleFieldLocator fl = new SimpleFieldLocator();
    new TraversalUtil(contentList, fl);
   
    report.append("\n\nSimple Fields in " + part.getPartName() + "\n");
    report.append("============= \n");
    report.append("Found " + fl.simpleFields.size() + " simple fields \n ");
   
View Full Code Here

    FldSimpleModel fsm = new FldSimpleModel(); //gets reused
    List contentList = ((ContentAccessor)part).getContent();
    WordprocessingMLPackage wmlPackage = (WordprocessingMLPackage)part.getPackage();
   
    ComplexFieldLocator fl = new ComplexFieldLocator();
    new TraversalUtil(contentList, fl);
   
    report.append("\n Complex Fields in "+ part.getPartName() + "\n");
    report.append("============== \n");
   
    report.append("Found " + fl.getStarts().size() + " fields \n");
View Full Code Here

    //  to make the code below TraversalUtil based)
    // RemovalHandler is an XSLT-based way of doing this,
    // but here we avoid introducing a dependency on
    // XSLT (Xalan) for PDF output.
    SdtBlockFinder sbr = new SdtBlockFinder();
    new TraversalUtil(document.getContent(), sbr);
    for( int i=sbr.sdtBlocks.size()-1 ; i>=0; i--) {
      // Have to process in reverse order
      // so that parentList is correct for nested sdt
     
      SdtBlock sdtBlock = sbr.sdtBlocks.get(i);
View Full Code Here

   
    ///////////////////////////////////////////////
    // First, contents of existing content controls
    // .. find the content controls
    SdtFinder sdtFinder = new SdtFinder();
    new TraversalUtil(mainDocument.getContent(), sdtFinder);
   
    // .. loop through them
    for (SdtElement sdtEl : sdtFinder.getSdtList()) {
      content = sdtEl.getSdtContent().getContent();
      groupedContent = groupContent(content);
     
      if (groupedContent != null) {
        content.clear();
        content.addAll(groupedContent);
      }
     
    }
   
   
    ///////////////////////////////////////////////
    // Second, contents of table cells
    TcFinder tcFinder = new TcFinder();
    tcFinder.setTraverseTables(true);
    new TraversalUtil(mainDocument.getContent(), tcFinder);
    for (Tc tc : tcFinder.tcList) {
     
      content = tc.getContent();
      groupedContent = groupContent(content);
     
View Full Code Here

    org.docx4j.wml.Document wmlDocumentEl = (org.docx4j.wml.Document) documentPart
        .getJaxbElement();
    Body body = wmlDocumentEl.getBody();
 
    CommentFinder cf = new CommentFinder();
      new TraversalUtil(body, cf);
 
      for (Child commentElement : cf.getCommentElements()) {
          System.out.println(commentElement.getClass().getName());
          Object parent = commentElement.getParent();
          List<Object> theList = ((ContentAccessor)parent).getContent();
View Full Code Here

       
    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));   
    MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
       
    ClassFinder finder = new ClassFinder(FldChar.class); // <----- change this to suit
    new TraversalUtil(documentPart.getContent(), finder);
   
    System.out.println("got " + finder.results.size()  );
   
    for (Object o : finder.results) {
           
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.