How to Strike Out Text in PPTX using Python

This topic focuses on how to strike out text in PPTX using Python. It includes the details to establish the environment along with the required resources, a step-wise procedure, and a working example code to strike out PPTX text using Python. It exhibits the process details including generating the sample presentation, inserting autoshape, adding the text frame by inserting the text and striking out the text.

Steps to Strike Out Text in PPTX using Python

  1. Establish the environment to use Aspose.Slides for Python via .NET to strike out text in PPTX
  2. Generate a default empty presentation using an instance of the Presentation class and access its first slide
  3. Create an autoshape and insert a sample textframe inside it
  4. Insert a portion of text inside the textframe and set the Double line strike through for the portion text using the TextStrikethroughType enumerator
  5. Insert a second portion of text inside the textframe and set the single line strike for the portion text using the TextStrikethroughType enumerator
  6. Save the PPTX presentation with strike through text on the disk

The above steps exhibit how to strike out text in Presentation using Python by exposing the details about all the required classes, methods, and properties to obtain the desired output. The Presentation class is used to create an empty or load an existing PPTX file, the ShapeCollection class is used to add the autoshape in the PPTX slide, and the TextStrikethroughType enumerator is used to set the required text strikethrough type for the selected portion.

Code to Strike Out Text in PPTX using Python

The above example code strikeout text in PPT using Python. It uses the Presentation class instance to generate a default empty presentation and use Presentation.Slides property to access the first slide inside the presentation slides collection. An autoshape is inserted, which is then followed by inserting portions of text inside it. Finally, with the help of the TextStrikethroughType enumerator, the desired text is struck out in the presentation and saved on the disk.

In this tutorial, we have learned to strike out presentation text using Python. If you are interested to learn about merging the Islides inside the presentation, refer to the article on How to Merge PowerPoint Files using Python.

 English