Skip to main content

PowerPoint editing via Open XML package manipulation

Project description

xmlppt

A small utility package for editing PowerPoint (.pptx) files by manipulating the Open XML package directly. It supports duplicating template slides, editing named textboxes, updating embedded Excel workbooks for charts, and basic listing/debug utilities.

This repository contains a single package xmlppt with the main implementation in xmlppt/editor.py and a minimal main.py example entrypoint.

Requirements

  • Python 3.10+
  • lxml
  • openpyxl
  • pywin32 (only required for refresh_chart() on Windows)

Install

Create a virtual environment and install dependencies:

python -m venv .venv
.venv\Scripts\Activate.ps1   # Windows PowerShell
pip install -r requirements.txt

Install the package locally for development:

pip install -e .

Quick usage (programmatic)

from xmlppt import PowerPointEditor

editor = PowerPointEditor('input.pptx')
editor.duplicate_template_slide('RESERVE_WATERFALL')
editor.edit_textbox_html('AOM Text', '<b>Updated</b>')
editor.save('output.pptx')

CLI example

Run the example entrypoint which shows basic diagnostics and attempts to run a sample flow (expects a marker template slide):

python main.py --input example.pptx --run-example

Run tests

pytest -q

CI

A GitHub Actions workflow is included at .github/workflows/python-package.yml that installs the package and runs the test suite on Windows.

Publishing

A release workflow is included at .github/workflows/publish.yml. When you create a GitHub release and publish it, the workflow will build and upload the package to PyPI using the PYPI_API_TOKEN secret.

To configure publishing:

  1. Create a PyPI API token at https://pypi.org/manage/account/token/
  2. Add it to your repository secrets as PYPI_API_TOKEN
  3. Create a release on GitHub

Notes

  • The refresh_chart() function uses COM automation to refresh chart visuals inside PowerPoint; this only works on Windows with PowerPoint installed.
  • The package manipulates the raw PPTX (zip) contents; always test on copies of presentations before running on production files.

Project details


Download files

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

Source Distribution

xmlppt-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xmlppt-0.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file xmlppt-0.1.0.tar.gz.

File metadata

  • Download URL: xmlppt-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for xmlppt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 46f649e1f67355a86c5de04e847272a84072c0c27c28d533d216858eed23d51f
MD5 7f142732724c49e8934b268c7f8685da
BLAKE2b-256 6cc12c504c7423db02e9e3b0d9cce9ad43b5dc599339be4bfb22b8c13ed5c855

See more details on using hashes here.

File details

Details for the file xmlppt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xmlppt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for xmlppt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb42974dbbeb9c2055aa82cf11533ecb7f59850156744c7be84a1524dd4b3243
MD5 0faa8993c5af33d332571140d24c6a14
BLAKE2b-256 7bdefb8ffa0a9605c76500fdb3d91657ca8ea7725076d9b30c77ce6758beaa7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page