Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Create customizable PowerPoint Presentation (.pptx) using a predefined layout template

Project description

python-pptx-templater is a tool to create highly customizable PowerPoint presentation using the jinja template languages. User specifies the layouts and placeholders and the template will render the presentation.

Example

Input

https://raw.githubusercontent.com/kwlo/python-pptx-templater/master/docs/static/images/sample_input.png

Using Template JSON:

{
    'slides': [
        {
            'layoutSlideNum': 0,
            'text': {
                'name': 'Paul'
            }
        },
        {
            'layoutSlideNum': 0,
            'text': {
                'name': 'Joe'
            }
        },
        {
            'layoutSlideNum': 1,
            'text': {
                'dog': {
                    'name': 'John Cena'
                }
            }
        },
    ]
}

Output

https://raw.githubusercontent.com/kwlo/python-pptx-templater/master/docs/static/images/sample_output.png

Install

pip install python-pptx-templater

Usage

from pptx_templater.core import convert


def test_conversion():
    currpwd = os.path.dirname(os.path.abspath(__file__))
    srcpath = f'{currpwd}/fixtures/test_presentation_layout.pptx'
    destpath = f'{currpwd}/test_outputs/updated.pptx'

    j = {
        'slides': [
            {
                'layoutSlideNum': 0,
                'text': {
                    'name': 'Paul'
                }
            },
            {
                'layoutSlideNum': 0,
                'text': {
                    'name': 'Joe'
                }
            },
            {
                'layoutSlideNum': 1,
                'text': {
                    'dog': {
                        'name': 'John Cena'
                    }
                }
            },
        ]
    }

    convert(srcpath, destpath, j)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-pptx-templater, version 1.1.15
Filename, size File type Python version Upload date Hashes
Filename, size python_pptx_templater-1.1.15-py3-none-any.whl (5.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size python-pptx-templater-1.1.15.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page