This project is read-only.

Apache POI SL - Create Slides with Different Layouts

XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("presentation.pptx"));

// blank slide

// there can be multiple masters each referencing a number of layouts
// for demonstration purposes we use the first (default) slide master
XSLFSlideMaster defaultMaster = ppt.getSlideMasters()[0];

// title slide
XSLFSlideLayout titleLayout = defaultMaster.getLayout(SlideLayout.TITLE);
// fill the placeholders
XSLFSlide slide1 = ppt.createSlide(titleLayout);

// title and content
XSLFSlideLayout titleBodyLayout = defaultMaster.getLayout(SlideLayout.TITLE_AND_CONTENT);
XSLFSlide slide2 = ppt.createSlide(titleBodyLayout);


//Instantiate Presentation class that represents the presentation file
Presentation pres = new Presentation();

//Instantiate SlideCollection calss
ISlideCollection slds = pres.getSlides();

for (int i = 0; i < pres.getLayoutSlides().size(); i++)
    //Add an empty slide to the Slides collection

Download Source Code

For More Examples, Please Visit Aspose Docs

Last edited Aug 29, 2014 at 7:04 AM by shoaibkhan, version 2