Examples of WordprocessingMLPackage


Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

  }

  private String setupApacheFopConfiguration(FOSettings settings) throws Docx4JException {
   
    String ret = settings.getApacheFopConfiguration();
    WordprocessingMLPackage wmlPackage = (WordprocessingMLPackage)settings.getWmlPackage();
    if (ret == null) {
      ret = FopConfigUtil.createDefaultConfiguration(wmlPackage.getFontMapper(),
          wmlPackage.getMainDocumentPart().fontsInUse());
    }
    return ret;
  }
View Full Code Here

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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

  @Test
  public void testTblStyle_BasedOn_Normal12() throws Exception {
   
    // Compat setting says Paragraph style overrides table style   
 
    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
    wordMLPackage.getMainDocumentPart().setContents(
        (Document)XmlUtils.unmarshalString(mdpXml_tblStyle) );
    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setContents(
        (Styles)XmlUtils.unmarshalString(styles_basedOn_Normal) );
   
    // Use our style!
    List<Object> xpathResults = wordMLPackage.getMainDocumentPart().getJAXBNodesViaXPath("//w:p", true);
    PPr ppr = Context.getWmlObjectFactory().createPPr();
    ((P)xpathResults.get(0)).setPPr(ppr);
    PStyle ps = Context.getWmlObjectFactory().createPPrBasePStyle();
    ps.setVal("testStyle");
    ppr.setPStyle(ps);
   
    setSetting(wordMLPackage, OVERRIDE);

    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
    ParagraphStylesInTableFix.process(wordMLPackage);
   
//    // Revert style and save:
//    ppr.setPStyle(ps); // doesn't work - wrong ref!
//    wordMLPackage.save(new File(System.getProperty("user.dir") + "/OUT_PStyleInTableTest.docx"));
   
    Style ours = null;
    for (Style s : wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().getContents().getStyle()) {
      if ("testStyle-TableNormal-BR".equals(s.getStyleId())) {
        ours = s;
        break;
      }
    }
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
View Full Code Here

Examples of org.docx4j.openpackaging.packages.WordprocessingMLPackage

    // 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);

    alterations.debug();
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.