Package org.docx4j.openpackaging.parts.PresentationML

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


    }

    PresentationMLPackage pMLPackage = (PresentationMLPackage) OpcPackage
        .load(new java.io.File(inputfilepath));

    SlidePart slide = (SlidePart) pMLPackage.getParts().get(
        new PartName("/ppt/slides/slide1.xml"));

    new TraversalUtil(slide.getJaxbElement().getCSld().getSpTree()
        .getSpOrGrpSpOrGraphicFrame(),

    new Callback()
    {
View Full Code Here


        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 = presentationMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide1.xml"));
       
    // Add image part
    File file = new File("data/pptx4j/greentick.png" );
        BinaryPartAbstractImage imagePart
          = BinaryPartAbstractImage.createImagePart(presentationMLPackage, slidePart, file);
   
           
        // Add p:pic to slide
    slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(
        createPicture(imagePart.getSourceRelationship().getId()));
   

    // Do it again on another slide
    SlidePart slidePart2 = presentationMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide2.xml"));
    Relationship rel = slidePart2.addTargetPart(imagePart);
   
    slidePart2.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(
        createPicture(rel.getId()));
   
    // All done: save it
    presentationMLPackage.save(new java.io.File(outputfilepath));
View Full Code Here

TOP

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

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.