Package org.docx4j.openpackaging.packages

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage


  public void testImageScaled() throws Exception {
    // document.xml should be different,

    log.warn("\ntestImageScaled\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "image-png1.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "image-png1-scaled.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here


    // document.xml and image part should be different,
    // but rels unchanged

    log.warn("\testImagesDifferentPng\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "image-png1.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "image-png2.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

    // Because we currently match images on name only, and
    // png is now called image2.png, that has changed as well.

    log.warn("\ntestImagesDifferentPng\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "images-jpg then png2.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "image-png2.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

    // both image names have changed as well.
   

    log.warn("\ntestImagesOrderSwapped\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "images-jpg then png2.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "images-png2 then jpg.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

    // and headers added: Word adds 3 x headers, 3 x footers, endnotes, and footnotes
    // plus header style

    log.warn("\ntestHeaderAdded\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "header-simple.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "paragraph-single.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

    // and headers added: doc now contains 2 x headers, 0 x footers, endnotes, and footnotes
    // Interesting that the number of header parts is reduced (and content of header1.xml changed)

    log.warn("\ntestHeaderAddedSection2\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "header-section2.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "header-simple.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

    // the affected header should be different,
    // plus image + header rels

    log.warn("\ntestHeaderImageAdded\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "header-simple-plus-image.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "header-simple.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

    // document.xml + rels + added comments part should be different,
    // also styles

    log.warn("\ntestComment\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "comments-one.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "paragraph-single.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

  public void testComment2() throws Exception {
    // document.xml + comments part should be different

    log.warn("\ntestComment2\n");
   
    WordprocessingMLPackage thisPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "comments-two.docx"));
    WordprocessingMLPackage otherPackage = WordprocessingMLPackage.load(
        new java.io.File(resourceDir + "comments-one.docx"));
   
    Alterations alterations = AlteredParts.start(thisPackage, otherPackage);

    Patcher.apply(otherPackage, alterations);
View Full Code Here

  public static void main(String[] args)
          throws Exception {

    String inputfilepath = System.getProperty("user.dir") + "/todd_p_spacing_direct.docx";
   
    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
    JaxbXmlPartXPathAware jaxbXmlPart = (JaxbXmlPartXPathAware)wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart();
   
    System.out.println(XmlPartToString.get(jaxbXmlPart));

    }
View Full Code Here

TOP

Related Classes of org.docx4j.openpackaging.packages.WordprocessingMLPackage

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.