Skip to main content

Replace {{KEY}} tokens in PPTX while preserving styling & swap frame shapes for images in while preserving sizes

Project description

pptxvars

  • Replace {{KEY}} tokens in PPTX while preserving styling
  • Swap a Frame for an image in PPTX while preserving size
  • Execute both in sequence from CLI or through import

Install pptxvars

pip install pptxvars

Replace Variables

  1. Create a custom powerpoint presentation
  2. Define your variables in powerpoint textboxes by {{VARIABLE_NAME}}
  3. Define in a YAML file what values must replace the {{KEYS}}. YAML format: KEY: "value"
  4. Execute replacement (from CLI):
pptxvars --template templates/example_prs.pptx `
         --vars templates/example.yml `
         --out 'output/{STEM}_{DATE}.pptx'

Swap Frame for Image

  1. Create a custom powerpoint presentation
  2. Insert frames as placeholder for an image. In powerpoint you can find a frame shape under: Insert>Shapes>Basic Shapes>Frame
  3. Define in a YAML file what Frames must be swaped. The Frames are swaped per slide in order (Top>Right). YAML format:
slides:
  - index: 1
    images:
      - example_img.png
  1. Execute image swap (from CLI):
pptxvars --template templates/example_prs.pptx `
         --imgs templates/image_swap.yml `
         --out "output/{STEM}_swapped.pptx"

Both in sequence: replace variables and swap frames for images

From powershell CLI:

pptxvars --template templates/input_prs.pptx `
          --vars templates/replace.yml `
          --imgs templates/img_swap.yml `
          --out "output/{STEM}_{DATE}.pptx"

From notebook by import:

from pptxvars import render_presentation

output_prs = render_presentation(
    template="templates/input_prs.pptx",
    vars_yml="templates/replace.yml",
    imgs_yml="templates/img_swap.yml",
    out_pattern="output/{STEM}_{DATE}.pptx",
)

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

pptxvars-1.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

pptxvars-1.0.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pptxvars-1.0.1.tar.gz.

File metadata

  • Download URL: pptxvars-1.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pptxvars-1.0.1.tar.gz
Algorithm Hash digest
SHA256 71c494dfce45594f42db788a08e1d4204c79e543e5035d34496ea6e9852066b0
MD5 b6d4f6d7e22bb0eed8fee6fd19c774d3
BLAKE2b-256 bf1bff97191260bb725e992d19d6e2750b10151812e9f902646a53c20f095f4e

See more details on using hashes here.

File details

Details for the file pptxvars-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pptxvars-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pptxvars-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe13546a0cc1d510fada3f1f4a8f8dd9d45c51f02f3b8e58fc3f6457ed0721fa
MD5 edadbb33958be52f024e2a2d300c472f
BLAKE2b-256 85ab4f53298ab38acc979d186456ea7c82c5a655dcb2726e9c5f92923a9191bd

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