PowerPoint Generator API
  • PowerPoint Generator API
  • Getting started
    • Quick start
  • API reference
    • token/create
    • generator/create
  • Knowledge base
    • Key concepts
    • Templating your presentation
    • Building your JSON payload
    • Finding shape names
  • JSON/ PPTX Reference
    • presentation
    • slides
    • shapes
      • textbox
      • chart
      • picture
      • table
    • tags
    • Deprecated
  • Examples
    • Presentation
      • Naming output presentation
      • Using multiple templates
    • Slide
      • Change shape size and position
      • Change shape background color
      • Hide or remove shape
      • Replacing tags
    • Textboxes
      • Add text
      • Set font type and size
      • Set font color and font background color
      • Set bold, italic & underline
      • Set text alignment
      • Set text indentation
      • Set text line spacing
      • Using bullet-points
    • Chart
      • Change font settings
      • Insert data
      • Adjust chart legend
      • Appending to data labels
    • Pictures
    • Table
      • Populate simple table
      • Using `text_runs` in Table cells
      • Handling merged cells
      • Update a specific cells in existing table
    • Tags
Powered by GitBook
On this page

Was this helpful?

  1. Examples
  2. Presentation

Using multiple templates

PreviousNaming output presentationNextSlide

Last updated 7 months ago

Was this helpful?

You may have a scenario where you want to build a PowerPoint using slides from multiple template PowerPoints.

To do this, you have to:

  1. Attach Files and/or Provide Template URLs:

    • File Attachment: Attach your template PowerPoint files as File attachments in the POST request, using the parameter name files.

    • Template URLs: You can also use URLs for templates stored online, such as in Google Drive or OneDrive, which provide direct download access.

  2. Define Templates in Your JSON Payload: Add a template_list parameter in your JSON payload, as shown below. The template_list should contain an entry for each template file, with a unique template_id and the name of each template file. Each template name must exactly match the filename of the corresponding "files" parameter sent in the form.

{
   "presentation":{
      "template_list":[
         {
            "template_id":1,
            "template":"template-1.pptx"
         },
         {
            "template_id":2,
            "template":"template-2.pptx"
         },
         {
            "template_id":3,
            "template":"template-3.pptx"
         }
      ]
      ....
      
  1. Assign Template IDs to Slides: In the JSON payload, specify a template_id for each slide to indicate which template file to use. Each slide object should include a slide_index and the template_id for the template it should follow.

"slides":[
   {
      "template_id":1,
      "slide_index":0,
   ....   

Important Note

You cannot use both a single template file and multiple templates together. The following example demonstrates incorrect syntax:

//This syntax is not allowed.
{
   "presentation":{
      "template":"template.pptx",
      "template_list":[
         {
            "template_id":1,
            "template":"template-1.pptx"
         },
         {
            "template_id":2,
            "template":"template-2.pptx"
         },
         {
            "template_id":3,
            "template":"template-3.pptx"
         }
      ],
      ....

Sample JSON payload:

{
  "presentation": {
    "export_version": "Pptx2010",
    "template_list": [
      {
        "template_id": 1,
        "template": "template-1.pptx"
      },
      {
        "template_id": 2,
        "template": "template-2.pptx"
      },
      {
        "template_id": 3,
        "template": "template-3.pptx"
      }
    ],
    "slides": [
      {
        "template_id": 1,
        "type": "slide",
        "slide_index": 0,
        "shapes": [
          {
            "name": "Chart 5",
            "data": [
              [
                "Total",
                "Male",
                "Female"
              ],
              [
                "Read a printed newspaper",
                "Visited a newspaper website",
                "Read a printed magazine",
                "Read a digital magazine"
              ],
              [
                43.15,
                44.13,
                42.22
              ],
              [
                41.36,
                44.02,
                38.83
              ],
              [
                25.39,
                23.69,
                26.99
              ],
              [
                5.39,
                7.37,
                3.52
              ]
            ]
          }
        ]
      },
      {
        "template_id": 2,
        "type": "slide",
        "slide_index": 0,
        "shapes": [
          {
            "name": "Chart 7",
            "data": [
              [
                "Total",
                "Male",
                "Female"
              ],
              [
                "Read a printed newspaper",
                "Visited a newspaper website",
                "Read a printed magazine",
                "Read a digital magazine"
              ],
              [
                43.15,
                44.13,
                42.22
              ],
              [
                41.36,
                44.02,
                38.83
              ],
              [
                25.39,
                23.69,
                26.99
              ],
              [
                5.39,
                7.37,
                3.52
              ]
            ]
          }
        ]
      },
      {
        "template_id": 3,
        "type": "slide",
        "slide_index": 0,
        "shapes": [
          {
            "name": "Chart 5",
            "data": [
              [
                "Total",
                "Male",
                "Female"
              ],
              [
                "Read a printed newspaper",
                "Visited a newspaper website",
                "Read a printed magazine",
                "Read a digital magazine"
              ],
              [
                43.15,
                44.13,
                42.22
              ],
              [
                41.36,
                44.02,
                38.83
              ],
              [
                25.39,
                23.69,
                26.99
              ],
              [
                5.39,
                7.37,
                3.52
              ]
            ]
          }
        ]
      }
    ]
  }
}