Merge 2 different presentations
claremont-awilson opened this issue · comments
I'm trying to merge 2 simple presentations together with the following code:
prs1 = Presentation(ppt1_filepath)
prs2 = Presentation(ppt2_filepath)
for slide in prs2.slides:
sl = prs1.slides.add_slide(prs1.slide_layouts[1])
sl.shapes.title.text = slide.shapes.title.text
sl.placeholders[1].text = slide.placeholders[1].text
prs1.save(ppt3_filepath)
Which I found here.
Unfortunately all of the slides in each presentation are built from the blank layout, and from what I've found in previous issues, does not have a title attribute, so the above just errors out.
>>> slide.shapes.title.text
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'NoneType' object has no attribute 'text'
Each slide just contains images and a couple of text boxes.
I was wondering if there's a way to achieve this? I don't need the slides in any order, I'd quite like to just append presentation 2 to the end of 1.
Not really answering your question but - if you have access to the following - VBA or AppleScript might be better tools for the job. (I've done the latter in the past and I would be almost certain it could be done with the former.)