pptx
recipe generates office powerpoint presentations based on the uploaded pptx template with handlebars tags filled inside using Powerpoint application.
Main helper used to multiply slides. The helper call should be placed on the slide and the system iterates over provided data and creates extra slide based on item's context.
{{pptxSlides item}}
Create a list with single item using Word and call the pptxList
helper. It will iterate over provided data and create another list item for every entry.
- {{#pptxList people}}{{name}}{{/pptxList }}
Create a table with columns header and single row using Pptx. Call {{#pptxTable}}
in the first cell of the data row and end the call {{/pptxTable}}
at the last cell.
columnA | columnB |
---|---|
--- | --- |
{{#pptxTable people}}{{name}} | {{email}}{{/pptxTable}} |
Use helper argument vertical=true
for rendering vertical table
name | {{#pptxTable people vertical=true}}{{name}} | |
{{email}}{{/pptxTable}} |
{{pptxImage src=myDataURIForImage}}
myDataURIForImage
prop in the input data and you should see the image replaced in the output.pptxImage
supports the following configuration properties:
src
(string
) -> specifies the base64 dataURI string representation of the image to load or an url from which to fetch the imageusePlaceholderSize
(boolean
) -> when true the dimensions of the image will be set to the same dimensions than the placeholder image defined on the pptx file. Ex: {{pptxImage src=src usePlaceholderSize=true}}
width
(string
) -> specifies the width of the image, value can be in px
or cm
. when only width
is set, the height
will be automatically generated based on the aspect ratio of the image. Ex: {{pptxImage src=src width="150px"}}
height
(string
) -> specifies the height of the image, value can be in px
or cm
. when only height
is set, the width
will be automatically generated based on the aspect ratio of the image. Ex: {{pptxImage src=src height="100px"}}
You can implement also your own custom helpers and use them in the word templates. The helpers section can be toggled in the studio using the "show helpers" button.
The recipe doesn't support using child templates or assets to insert another pptx file into one template. Both can be used just to insert text.
See general documentation for office preview in studio here.
{
"template": {
"recipe": "pptx",
"engine": "handlebars",
"pptx": {
"templateAssetShortid": "xxxx"
}
},
"data": {}
}
In case you don't have the office template stored as an asset you can send it directly in the API call.
{
"template": {
"recipe": "pptx",
"engine": "handlebars",
"pptx": {
"templateAsset": {
"content": "base64 encoded word file",
"encoding": "base64"
}
}
},
"data": {}
}