I have several .pptx files to work on, and I want to copy slides which contain specific keyword to another .pptx.
For example, for file A.pptx, if there is the keyword(maybe like Apple) in the slide, then it will copy this slide to another new_one.pptx. And the slides in new_one.pptx all mention about Apple(the keyword).
But I just find the way to extract and copy all text from slides.
from pptx import Presentation
prs = Presentation("A.pptx")
text_runs = []
for slide in prs.slides:
for shape in slide.shapes:
if not shape.has_text_frame:
continue
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
text_runs.append(run.text)
prs.save("new_one.pptx")
Could anyone give me some solutions or directions,please? Better if there is a example scripts. Thanks in advance.