0

To print specific slides from a PowerPoint presentation, based on a list of items we use the basic PowerPoint tool Ctrl+F following this process:
-save the slide ID
-save the second slide ID
-print with those IDs and that takes a lot of workloads.

We think to automate this task with a Python script.

from pptx import Presentation

filename = "C:/Users/RElKassah/Desktop/test.pptx"

prs = Presentation(filename)
text="test"
for slide in prs.slides:
    if slide.shapes ==text:    
        title = slide.shapes.text.find = 'test'
        print(title)

1 Answer 1

1

Here I wrote some simple loop to find text inside a pptx file, then print slide number of slides that contain that text. Hope it could help.

from pptx import Presentation

filename = 'test.pptx'

prs = Presentation(filename)
text="test"
for slide in prs.slides:
    for shape in slide.shapes:
        if shape.has_text_frame:
            for paragraph in shape.text_frame.paragraphs:
                for run in paragraph.runs:
                    if text in run.text:
                        print(prs.slides.index(slide)+1)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.