Gowtham
Gowtham

Reputation: 141

How to insert a custom layout to the powerpoint using python pptx

I am trying to create 1000s of powerpoint presentations. I am using python pptx to achieve that. So far so good, but I dont like the slide size which is by default 4:3. Can I create a template slide(with custom formatting of slide size and default icons) and use that in all powerpoints that I am creating?
If yes can someone help me out with the process ? Generally I use

blank_slide_layout = prs.slide_layouts[6]
Slide = prs.slides.add_slide(blank_slide_layout)

Hope their will be a way to access the saved template with
prs.Slides.add_slide(custom_template_1)

Thanks in advance

Upvotes: 5

Views: 14299

Answers (1)

scanny
scanny

Reputation: 29031

Create a customized template presentation set to the size you want. Then all presentations created from that "template" will be that size.

To create a template, just delete all the slides out of a .pptx file. Then start your presentation with:

prs = Presentation('my-template.pptx')

instead of:

prs = Presentation()

Be sure you understand this page in the documentation:
http://python-pptx.readthedocs.io/en/latest/user/presentations.html

Upvotes: 6

Related Questions