1. Products
  2.   Editor
  3.   Python
  4.   python-pptx
 
  

Open-Source Python PPTX Editor Library

Free & Open Source Python library to create and edit PowerPoint PPTX files.

What is Python-PPTX?

Python-pptx is an open-source API to create, read and modify Microsoft PPTX files. PPTX is the Open XML format introduced by Microsoft in PowerPoint 2007 and later versions. It can be used to analyze PowerPoint files by reading these to extract search indexing text and images. With Python-pptx, you can generate a PowerPoint presentation from dynamic content such as a database query, analytics output, or a JSON payload. This lets you cater to an HTTP request in your Python application and download the generated PPTX file in response.

Python-pptx API Features

Following are some of the main features of Python-PPTX API:

  • Single API to create, read, and update PowerPoint PPTX files by loading from multiple input sourcs such as file and memorystreams.
  • Able to run on any Python capable platform, including macOS and Linux, and does not require the PowerPoint application to be installed or licensed.
  • Can be used to automate the production of a slide or two that would be tedious to get right by hand.
  • Create slides programmatically using the slide object
  • Generate a PowerPoint presentation from dynamic content such as a database query, analytics output, or a JSON payload
  • Round-trip any Open XML presentation (.pptx file) including all its elements
  • Add slides
  • Populate text placeholders, for example to create a bullet slide
  • Add image to slide at arbitrary position and size
  • Add textbox to a slide; manipulate text font size and bold
  • Add table to a slide
  • Add auto shapes (e.g. polygons, flowchart shapes, etc.) to a slide
  • Add and manipulate column, bar, line, and pie charts
  • Access and change core document properties such as title and subject
GitHub

GitHub Stats

Name:
Language:
Stars:
Forks:
License:
Repository was last updated at

Getting Started with python-pptx

You can download the python-pptx library from GitHub or using pip install command:

Installation

Installing python-pptx is simple and can be done from terminal as shown below:

Installing python-ptpx


pip3 install python-pptx

python-pptx Code Examples

Examples using the python-pptx Python library are as follow. You can use the FREE PowerPoint PPTX file template to try these examples.

Create a PowerPoint PPTX with python-pptx

You can create a blank PowerPoint PPTX using python-pptx from scratch.

Read a PowerPoint PPTX with python-pptx

python-pptx lets you read a PowerPoint PPTX file from disc from within your Python application. The following code sample shows how to read a PowerPoint PPTX file with python-pptx.

Add Textbox to PowerPoint PPTX file with python-pptx

python-pptx gives you full leverage to add slides to a PPTX file and add text box to it where you can add text. This is as demonstrated in the following code sample.

Add Bullets to PPTX File with python-pptx

You can add bullet points to a PowerPoint PPTX file with python-pptx. The following code sample shows how bullet points are being added to a presentation's slides.

Resources

  • python-pptx Documentation
  • FREE PowerPoint PPTX Template File
  • Conclusion

    python-pptx is a very powerful library for generating PowerPoint PPTX files. As an applicaiton developer, you can use this API to create PowerPoint PPTX files, and add different elements to the slides such as text placeholders, images, tables, textboxes, auto shapes, as well as change core document properties.

    Similar Products

     English