GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - PaleNeutron/pptx-replace: A python package for replacing words, images and other elements in pptx

BranchesTags
Open more actions menu

Latest commit

 

History

51 Commits
51 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
pptx_replace
pptx_replace
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

pptx-replace

A python package for replaceing text, images and tables in pptx files

import pptx
import pptx_replace

prs = Presentation("tests/templates/test_template.pptx")
replace_text(prs, "{Main title}", "this is main report title")
slide = prs.slides[1]
replace_text(slide, "{title}", "This is a title")
replace_picture(prs.slides[0], "image.png", auto_reshape=True)

installation

pip install pptx-replace

If you want to put altair picture into pptx file, you need install some extra packages.

pip install "pptx-replace[alt]"

see: https://github.com/altair-viz/altair_saver

extra dependency

Depends on your usage, if you want to export table and keep style in jupyter, selemium and browser driver is required.

see: https://github.com/dexplo/dataframe_image/

usage

First open your pptx file.

import pptx
import pptx_replace

prs = Presentation("tests/templates/test_template.pptx")

replace text

Replace any text in your ppt

# repalce all occurances of {Main title} in pptx
replace_text(prs, "{Main title}", "this is main report title")
slide = prs.slides[1]

# replace in just one slide
replace_text(slide, "{title}", "This is a title")

replace_text(slide, "{content}", "a quick brown fox jumps over the lazy dog\n" * 5)

replace picture

Replace picture just by matplotlib figuer!

import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4])
fig = plt.gcf()

replace_picture(prs.slides[1], fig, auto_reshape=False, order="l2r")

replace table

replace table by pandas dataframe

import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.rand(6, 10))
replace_table(slide, df)

About

A python package for replacing words, images and other elements in pptx

Resources

Readme
Activity

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.