This tutorial covers how to strike out text in PPTX using Java. It covers all the details to establish the environment, a step-wise process, and a working sample code to strike out PPTX text using Java. It discloses the details including generating a sample presentation, creating an autoshape, adding a text frame by inserting the text, and striking through the text.
Steps to Strike Out Text in PPTX using Java
- Configure the environment to add Aspose.Slides for Java to strike out text in PPTX
- Create an empty presentation using an instance of the Presentation class and access the first slide
- Create an autoshape of the Rectangle type and insert a sample textframe inside it
- Add a portion of text inside the text frame and set the Double line strike through using the TextStrikethroughType enumerator
- Add a second portion of text inside the text frame and set the single line strike through using the TextStrikethroughType enumerator
- Save the presentation with strikethrough text on the PPTX
The above mentioned steps cover how to strike out text in Presentation using Java using a few API calls. All the concerned classes and methods are specified and utilized in a well-defined manner to obtain the desired output; like a Presentation class instance is used for creating an empty or loading the existing PPTX file, the ShapeCollection class instance is used for adding an autoshape in the PPTX slide, the TextStrikethroughType enumerator is used to set the required text strikethrough type for the selected portion of the text.
Code to Strike Out Text in PPTX using Java
This example demonstrates strikeout text in PPT using Java. It utilizes the Presentation class object to generate the default empty presentation and uses the Presentation.getSlides() method to load the first slide from the presentation slides collection. An autoshape is created, which is then followed by inserting text inside it. Finally, the selected text inside the portion is struck through using the TextStrikethroughType enumerator, and the presentation with strikeout text is saved on the disk.
In this example, we have learned how to strike out presentation text using Java. If you are interested in learning about the process to merge the slides inside the presentation, refer to the article on how to merge slides in Java.