Package org.docx4j.openpackaging.parts.PresentationML

Examples of org.docx4j.openpackaging.parts.PresentationML.MainPresentationPart


   
    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)pMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)pMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
View Full Code Here


   
    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
View Full Code Here

    String outputfilepath = System.getProperty("user.dir") + "/sample-docs/pptx/AutoShapes.pptx";
   
    // Create skeletal package
    PresentationMLPackage presentationMLPackage = PresentationMLPackage.createPackage();
   
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));
   
    SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
View Full Code Here

    
    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
    SlidePart slidePart = new SlidePart(new PartName("/ppt/slides/slide1.xml"));
    slidePart.setContents( SlidePart.createSld() );   
    pp.addSlide(0, slidePart);
   
    // Slide layout part
    slidePart.addTargetPart(layoutPart);
   
       
View Full Code Here

   
    // Create a package
    PresentationMLPackage pmlPack = new PresentationMLPackage();

    // Presentation part
    MainPresentationPart pp;
    try {
     
      pp = new MainPresentationPart();
      pp.setJaxbElement(
          MainPresentationPart.createJaxbPresentationElement(sz, landscape) );
      pmlPack.addTargetPart(pp);   
     
//      // Slide part
//      SlidePart slidePart = new SlidePart();
//      pp.addSlideIdListEntry(slidePart);
//
//      slidePart.setJaxbElement( SlidePart.createSld() );
     
      // Slide layout part
      SlideLayoutPart layoutPart = new SlideLayoutPart();
      layoutPart.setJaxbElement( SlideLayoutPart.createSldLayout() );
     
//      slidePart.addTargetPart(layoutPart);
     
      // Slide Master part
      SlideMasterPart masterPart = new SlideMasterPart();
      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",
            "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

   
    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
    SlidePart slidePart = new SlidePart(new PartName("/ppt/slides/slide1.xml"));
    slidePart.setContents( SlidePart.createSld() );   
    pp.addSlide(0, slidePart);
   
    // Slide layout part
    slidePart.addTargetPart(layoutPart);
       
    // Create and add shape
    Shape sample = ((Shape)XmlUtils.unmarshalString(SAMPLE_SHAPE, Context.jcPML) );
    slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(sample);
   
    // Now add notes slide.
    // 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>
     */
    pp.getJaxbElement().setNotesMasterIdLst(createNotesMasterIdListPlusEntry(ppRelNmp.getId()));
   
    // .. NotesMasterPart typically has a rel to a theme
    // .. can we get away without it?
    // Nope .. read this in from a file
    ThemePart themePart = new ThemePart(new PartName("/ppt/theme/theme2.xml"));
View Full Code Here

   
    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
View Full Code Here

    String inputfilepath = System.getProperty("user.dir") + "/Presentation1.pptx";
   
    PresentationMLPackage presentationMLPackage =
      (PresentationMLPackage)OpcPackage.load(new java.io.File(inputfilepath));
   
    MainPresentationPart mpp = presentationMLPackage.getMainPresentationPart();
   
    //mpp.removeSlide(10);
    Relationship rel = mpp.getRelationshipsPart().getRelationshipByID("rId2");
    mpp.removeSlide(rel);
   
   
    System.out.println("\n\n saving .. \n\n");
    String outputfilepath = System.getProperty("user.dir") + "/pptx-out.pptx";
    presentationMLPackage.save(new java.io.File(outputfilepath));
View Full Code Here

   
    // root
    styles.add(TextStyles.createVirtualStylesForDocDefaults(fontScheme));
   
    // presentation.xml
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));
    styles.addAll(
        TextStyles.generateWordStylesFromPresentationPart(
            pp.getJaxbElement().getDefaultTextStyle(),
            "", fontScheme));

    // master
    SlideMasterPart master = (SlideMasterPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideMasters/slideMaster1.xml"));
View Full Code Here

   
    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
View Full Code Here

TOP

Related Classes of org.docx4j.openpackaging.parts.PresentationML.MainPresentationPart

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.