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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pptxvars-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b412fe3576e62ac2e0ab21f05226ef6304664e120bcff7bc44db98e47d36c757
MD5 72e11ae3522f5c34a695e4eaa370b946
BLAKE2b-256 6c7deef791de15edc4462710c298b41225c71ceebfd7068aa4ccaaa34dcb9f72

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pptxvars-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a560f561905702a959dd3e37e32a69224f2267a75b771eee4f0904ec6adeacd6
MD5 fa015001347c40918bbd2f412ddbf16e
BLAKE2b-256 4b4880c328a54a4b75761529ecf351f7c87af5ad6aa97b5ed0f49114624dbd15

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