Using multiple templates

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. Include your template PowerPoint file as a "File" with your POST request to the API. Give your parameter name "files".

2. Include a reference with the name template_list to your JSON payload as below. template list contains template_id and template_name properties. The template_id will later be used by the JSON payload to define which template file is used for each slide. The template_name must be the same name as the filename sent with the form as the "files" parameter.

{
   "presentation":{
      "template_list":[
         {
            "template_id":1,
            "template_name":"template-1.pptx"
         },
         {
            "template_id":2,
            "template_name":"template-2.pptx"
         },
         {
            "template_id":3,
            "template_name":"template-3.pptx"
         }
      ]
      ....
      

3. At the JSON payload give template_id for each slide.

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

You can't provide multiple template files and a single template file together as shown below.

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

Sample JSON payload:

{
  "presentation": {
    "export_version": "Pptx2010",
    "template_list": [
      {
        "template_id": 1,
        "template_name": "template-1.pptx"
      },
      {
        "template_id": 2,
        "template_name": "template-2.pptx"
      },
      {
        "template_id": 3,
        "template_name": "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": 4,
        "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": 12,
        "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
              ]
            ]
          }
        ]
      }
    ]
  }
}

Last updated