Python API to Generate PowerPoint PPTX Presentation

Open Source Python library to Create, Modify & Export Microsoft PowerPoint PPTX files.

 

Python-PPTX is an Open Source Python library that enables software programmers to easily generate and manipulate Open XML PowerPoint (PPTX) files inside their own Python apps without any external dependencies. It helps developers to automate the production of PPTX presentation by customizing PowerPoint presentation creation from database content or make bulk updates to a library of presentations or automate the production of slides.

The library provides support for several important features such as generate & edit a presentation, insert new slides, Add text-box to a slide, manipulate text font size, table addition to slide, auto shapes support, add & manipulate column, bar, line, or pie charts and many other features.

Getting Started with Python-PPTX

Python-PPTX is hosted on PyPI, so installing with pip is simple. Please use the following command.

pip command

 pip install python-pptx  

lxml package and Pillow both are required for Python-PPTX to run smoothly. The charting features depend on XlsxWriter. Both pip and easy_install will take care of satisfying these dependencies for you. If you want to install it using setup.py then you will require installing the dependencies yourself.

Generate & Modify PowerPoint PPTX Presentation using Python API

Python-PPTX API provides functionality for new PowerPoint PPTX presentations creation as well as modification inside Python applications. Software developers can easily modify an existing presentation by opening the existing presentation. It allows adding slides, specifying a layout for new slide, adding title and contents, inserting images and shapes, etc. Once done you can change the name of the existing presentation as well as can save it to the location of your choice.

Working with PPTX Slide and Images

Python-PPTX is a great library for using Python to create dynamic PowerPoint slides. Software programmers can add a slide to an existing presentation with ease. Every slide in a presentation is based on a slide layout.  Slide layout is like a template for a slide, it allows users to inherit formatting choices, text boxes, titles or graphics, etc.

Adding & Modifying Charts to A Presentation

Python-PPTX API allows software developers to add charts to a slide and also modify existing ones inside their own applications. The API supports the most common chart types other than 3D types. You can add a single-series column chart, multi-series chart, bubble chart, Line chart, pie charts & more. By default, the colors assigned to each series in a chart are the theme colors Accent 1 through Accent 6, in that order.  You can also assign specific colors to data points in pie, bar, line segment for at least some chart types.  The easiest and suggested way will be to change the theme colors in your starting “template” presentation.