To Format text on a slide in PowerPoint Presentation using Java, use a Java Library called Apache POI. Apache POI is a project run by the Apache Software Foundation, and previously a sub-project of the Jakarta Project provides pure Java libraries for reading and writing files in Microsoft Office formats, such as Word, PowerPoint, and Excel. Use the Apache guide to install the Apache POI libraries for Windows/Linux Systems.
- Create an empty Presentation Object using XMLSlideShow from the Apache POI package.
- Create SlideMaster Object and get first slide using XSLFSlideMaster.
- Set the Layout of Slide using XSLFSlideLayout Object.
- Create Slide using the Layout.
- Get the second title of Slide using XSLFTextShape Object and add Paragraph to it using XSLFTextParagraph Object.
- Add Lines to paragraph using XSLFTextRun Object and add formatting attributes.
After execution of the program :
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.