scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.37k stars 513 forks source link

Feature/wide template #783

Open barronh opened 2 years ago

barronh commented 2 years ago

The PR addresses issues raised in issue #723. Specifically, it adds the capability for a user to specify which template to use for a new Presentation. The key change was adding a keyword to the api and a new template for 16x9 ratio slides (aka wide). The wide.pptx is made using Powerpoint from Office16.

After the changes, I ran tox using py27 and py36 (not py38, but should have similar performance). All existing tests pass. I also did basic manual tests using pptx.Presentation.

  1. without specifying a template still makes the same file using the pptx/templates/default.pptx.
  2. specifying template='default' still makes the same file using the pptx/templates/default.pptx.
  3. specifying template='wide' now makes a 16x9 ratio format using the pptx/templates/wide.pptx.

I did not modify the tests/test_api.py because I am not familiar with the approach using those types of fixtures. Ideally, an additional test version using the alternate template would be added.