If you want to add new slide to the presentation document, you can use the following codes:
Here the SlideLayout is the layout model of the added slide, the first parameter is the index of the added slide and the second parameter is the name of this slide.
PresentationDocument document=PresentationDocument.newPresentationDocument();
document.newSlide(1, "new slide", SlideLayout.TITLE_ONLY);
You can copy a slide in the presentation document from one position to another by using the following codes:
Here the first parameter is the source position of the slide need to be copied, the second parameter is the destination position of the slide need to be copied, and the last parameter is the new name of the copied slide.
document.copySlide(1, 2, "copied slide");
And also you can copy a slide from another document by using the following codes:
Here the first parameter of copyForeignSlide is the new position of the copied slide in the current document, the second parameter is the source document of the copied slide, and the last one is the slide index of the source document that need to be copied.
To move one slide to another position of this presentation position, you can use the following codes:
Here the first parameter is the current index of the slide that need to be moved, and the second parameter is the index of the destination position before the move action.
document.moveSlide(2, 1);
You can delete the slide either by through the index or through the name of the specified slide, like follows:
You can set the text content of a slide with text box API since version 0.5. Below codes will get the title text box of a slide, set the text content, and then get the outline text box, set the list content.
Textbox titleBox = slide.getTextboxByUsage(PresentationClass.TITLE).get(0);
titleBox.setTextContent("This is the title"); Textbox outline = slide.getTextboxByUsage(PresentationClass.OUTLINE).get(0); List txtList = outline.addList();
txtList.addItem("List Item1");
txtList.addItem("List Item2");
To add some text, you can first get the notes of one slide and then add text to this corresponding notes. The following codes shows this process: