Skip to main content

Replace {{KEY}} tokens in PPTX while preserving styling

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

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.0.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.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pptxvars-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 1b2b5103a91c66264f4661850ee89c624944c312416dec1768323773417ff657
MD5 5dd0bec7fef9c59a825dafc42c7c0877
BLAKE2b-256 de749b1322d16887ae757902fec49dc9386ba5531818f6c2ef5520f25c2e3755

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pptxvars-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c08fd2ea2f14b3a51c20ded0be7cc18411fc71a661931cf872c1202b5f0a90
MD5 df9c52cce63d578d47d79bf87b303519
BLAKE2b-256 4e2ed5ee41c95ee78ea6b20301688af79543a87dad88f876dc296ca5814a8e04

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