Skip to content

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

License

Notifications You must be signed in to change notification settings

kwlo/python-pptx-templater

Repository files navigation

python-pptx-templater

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)

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published