Examples of addTargetPart()


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

    int partsCountBefore = wordMLPackage.getParts().getParts().size();

    // Add it again
    // Note that we're adding this ELSEWHERE in the pkg for the purposes of this test only
    HeaderPart part2 = new HeaderPart()
    Relationship rel = wordMLPackage.addTargetPart(part2, mode);
    if (mode==AddPartBehaviour.REUSE_EXISTING) {
      // In the REUSE_EXISTING case, we won't be adding this part, so
      // we can't add content to it (since its pkg isn't set)
      part2 = (HeaderPart)wordMLPackage.getRelationshipsPart().getPart(rel);
    }
View Full Code Here

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

    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
    MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();

    org.docx4j.openpackaging.parts.DocPropsCustomPart docPropsCustomPart = new DocPropsCustomPart();
    wordMLPackage.addTargetPart(docPropsCustomPart);
    org.docx4j.docProps.custom.ObjectFactory cpfactory = new org.docx4j.docProps.custom.ObjectFactory();
    org.docx4j.docProps.custom.Properties customProps = cpfactory.createProperties();
    docPropsCustomPart.setJaxbElement(customProps);
   
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.MainPresentationPart.addTargetPart()

            "org/docx4j/openpackaging/parts/PresentationML/theme.xml");
      themePart.unmarshal(is);
     
      // .. add it in 2 places ..
      masterPart.addTargetPart(themePart);
      pp.addTargetPart(themePart);
     
     
    } catch (Exception e) {
      e.printStackTrace();
      throw new InvalidFormatException("Couldn't create package", e);
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.MainPresentationPart.addTargetPart()

    // 1. Notes master
    NotesMasterPart nmp = new NotesMasterPart();
    NotesMaster notesmaster = (NotesMaster)XmlUtils.unmarshalString(notesMasterXml, Context.jcPML);
    nmp.setJaxbElement(notesmaster);
    // .. connect it to /ppt/presentation.xml
    Relationship ppRelNmp = pp.addTargetPart(nmp);
    /*
     *  <p:notesMasterIdLst>
                <p:notesMasterId r:id="rId3"/>
            </p:notesMasterIdLst>
     */
 
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.NotesMasterPart.addTargetPart()

    ThemePart themePart = new ThemePart(new PartName("/ppt/theme/theme2.xml"));
      // TODO: read it from a string instead
    themePart.unmarshal(
        FileUtils.openInputStream(new File(System.getProperty("user.dir") + "/theme2.xml"))
      );   
    nmp.addTargetPart(themePart);
   
    // 2. Notes slide
    NotesSlidePart nsp = new NotesSlidePart();
    Notes notes = (Notes)XmlUtils.unmarshalString(notesXML, Context.jcPML);
    nsp.setJaxbElement(notes);
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.NotesSlidePart.addTargetPart()

    Notes notes = (Notes)XmlUtils.unmarshalString(notesXML, Context.jcPML);
    nsp.setJaxbElement(notes);
    // .. connect it to the slide
    slidePart.addTargetPart(nsp);
    // .. it also has a rel to the slide
    nsp.addTargetPart(slidePart);
    // .. and the slide master
    nsp.addTargetPart(nmp);
   
   
   
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.NotesSlidePart.addTargetPart()

    // .. connect it to the slide
    slidePart.addTargetPart(nsp);
    // .. it also has a rel to the slide
    nsp.addTargetPart(slidePart);
    // .. and the slide master
    nsp.addTargetPart(nmp);
   
   
   
    // All done: save it
    presentationMLPackage.save(new java.io.File(outputfilepath));
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.SlideLayoutPart.addTargetPart()

      pp.addSlideMasterIdListEntry(masterPart);

      masterPart.setJaxbElement(masterPart.createSldMaster() );
      masterPart.addSlideLayoutIdListEntry(layoutPart);
     
      layoutPart.addTargetPart(masterPart);
     
      // Theme part
      ThemePart themePart = new ThemePart(new PartName("/ppt/theme/theme1.xml"));
      java.io.InputStream is = ResourceUtils.getResourceViaProperty(
          "pptx4j.openpackaging.packages.PresentationMLPackage.DefaultTheme",
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.SlideMasterPart.addTargetPart()

          "pptx4j.openpackaging.packages.PresentationMLPackage.DefaultTheme",
            "org/docx4j/openpackaging/parts/PresentationML/theme.xml");
      themePart.unmarshal(is);
     
      // .. add it in 2 places ..
      masterPart.addTargetPart(themePart);
      pp.addTargetPart(themePart);
     
     
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.docx4j.openpackaging.parts.PresentationML.SlidePart.addTargetPart()

    // DiagramDataPart
    DiagramDataPart data = new DiagramDataPart(new PartName("/ppt/diagrams.data1.xml"));
    data.setPackage(pMLPackage); // otherwise we need to pass pkg around
    data.setJaxbElement( createDiagramData(data, xml) );
   
    String layoutRelId = slidePart.addTargetPart(layout).getId();
    String dataRelId = slidePart.addTargetPart(data).getId();
    String colorsRelId = slidePart.addTargetPart(colors).getId();
    String styleRelId = slidePart.addTargetPart(style).getId();
   
    // Create and add graphicFrame for SmartArt
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.