Template and Data

SlidePack requires a zip archive as input. It consists of a template (in PPTX format), data (in JSON format), and optionally, additional assets such as images.

input.zip
├─ template.pptx   (required)
├─ data.json       (required)
├─ :
└─ :               (optional images, etc.)

template.pptx

The template is much like a Pug or Mustache template (if you are familiar with those), except in PowerPoint's PPTX format. This file should always be named template.pptx.

Template slides can contain placeholders indicated by {key}. Placeholders are replaced with values from your data.json that has the matching object key.

template.pptx

1
template.pptx slide 1
2
template.pptx slide 2

Different types of objects have specific ways of marking the target elements.

  • Text and bullet lists: Occurences of {key} are replaced with the supplied string value.
  • Tables and charts: Tables and charts with alt text matching the key are populated with the supplied data.
  • Images and videos: SlidePack replaces shapes that contain {key} with the supplied image or video.

data.json

data.json holds the data to populate the template with, and also defines the composition of your output PPTX. This file should always be named data.json.

data.json

{
  "slides": [
    {
      "template": 1,
      "some_text": {
        "type": "text",
        "value": "Text to place"
      },
      "more_text": {
        "type": "text",
        "value": "More text to place"
      }
    },
    {
      "template": 2,
      "my_image": {
        "type": "image",
        "src": "pics/client_logo.png"
      }
    },
    {
      "template": 2,
      "my_image": {
        "type": "image",
        "src": "pics/our_logo.png"
      }
    }
  ]
}

The top-level slides array defines the list of slides that should compose the generated output. In this example, the output will have three slides in total: one slide based on template slide no.1, followed by two slides based on template slide no.2.

Each slide object requires a "template": number, designating which template slide to use. This is followed by key-value entries that provide data objects for each key in the template slide.

Data objects include a type property to signify what kind of object it represents (e.g. text, image) followed by data content and additional options. For a comprehensive list of supported objects, along with their required properties and options, see the data.json reference.

Authoring tips

  • Text and shape styles (like font size colors) used in the template are kept for your output, but you can override some of them by specifying options in your data.json.
  • SlidePack requires valid JSON - make sure there are no trailing commas in lists and objects.