Package org.docx4j.openpackaging.packages

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage.save()


    String html = "<html><head><title>Import me</title></head><body><p>Hello World!</p></body></html>";

    wordMLPackage.getMainDocumentPart().addAltChunk(AltChunkType.Html, html.getBytes());

    wordMLPackage.save(new java.io.File(System.getProperty("user.dir") + "/test.docx"));   
  }

}
View Full Code Here


    traverseRelationships(wordMLPackage, rp, sb, "    ");
   
    System.out.println(sb.toString());
   
    if (save) {
      wordMLPackage.save(new java.io.File(outputfilepath));
      System.out.println("Saved stripped to " + outputfilepath);
    } else {
      System.out.println("Stripped parts from " + inputfile.getName() );
    }
  }
View Full Code Here

    // Now add before this sectPr, whatever content you
    // want at the beginning
    org.docx4j.wml.P  yourContent = objectFactory.createP();
    mainContent.add(0,yourContent);    
 
    output.save(new File(System.getProperty("user.dir")
          + "/simpleH_OUT.docx"));
  }
 

 
View Full Code Here

     
      WordprocessingMLPackage output = org.docx4j.model.fields.merge.MailMerger.getConsolidatedResultCrude(wordMLPackage, data, true);
     
//      System.out.println(XmlUtils.marshaltoString(output.getMainDocumentPart().getJaxbElement(), true, true));
     
      output.save(new java.io.File(
          System.getProperty("user.dir") + "/OUT_FieldsMailMerge.docx") );
     
    } else {
      // Need to keep the MERGEFIELDs. If you don't, you'd have to clone the docx, and perform the
      // merge on the clone.  For how to clone, see the MailMerger code, method getConsolidatedResultCrude
View Full Code Here

                .createPackage();

    Relationship relationship = createHeaderPart(wmlPackage);
    createHeaderReference(wmlPackage, relationship);
        File f = new File(System.getProperty("user.dir") + "/waterMarksample.docx");
        wmlPackage.save(f);

    }
   
  public static Relationship createHeaderPart(
      WordprocessingMLPackage wordprocessingMLPackage)
View Full Code Here

  //    settings.setAttachedTemplate(je.getValue());
    }
   
    // Now save it
    if (save) {
      wordMLPackage.save(new java.io.File(inputfilepath) );
    }
  }
 
 
}
View Full Code Here

          id1, id2, 6000 );
    wordMLPackage.getMainDocumentPart().addObject(p3);
   
   
    // Now save it
    wordMLPackage.save(new java.io.File(System.getProperty("user.dir") + "/OUT_AddImage.docx") );
   
  }

  /**
   * Create image, without specifying width
View Full Code Here

    System.out.println(
        XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true)
        );
   
   
    wordMLPackage.save(new java.io.File(outputfilepath) );
  }
   

}
View Full Code Here

    // ++, for next comment ...
    commentId = commentId.add(java.math.BigInteger.ONE);

    // Now save it
    if (save) {
      wordMLPackage.save(new java.io.File(inputfilepath) );
      System.out.println("Saved " + inputfilepath);
    } else {
         // Show the Flat OPC XML
      FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wordMLPackage);
      worker.marshal(System.out);
View Full Code Here

        XmlUtils.marshaltoString(mdp.getJaxbElement(), true, true) );
   
    // Optionally save it
    if (save) {
      String filename = System.getProperty("user.dir") + "/OUT_CreateWordprocessingMLDocument.docx";
      wordMLPackage.save(new java.io.File(filename) );
      System.out.println("Saved " + filename);
    }
           
  }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.