Layout: PPTX#
WARNING: This feature is currently in BETA and has not been fully tested yet. API or feature changes may happen at any time. Follow the changelog for updates.
ADR now allows the creation of PowerPoint presentations with report templates and data items through the creation of a special template called a PPTX Layout Template.
A PPTX Layout Template needs 3 properties to function correctly. In addition to these properties, PPTX Layout Templates can also have their own filter queries set on them in order to filter the number of items being used inside themselves and their children. The properties are:
input_pptx :
ADR needs an input PowerPoint template file to begin with. This should contain a bunch of empty slides with placeholders that must be filled with items.
A placeholder can be created using any pptx editor like Microsoft PowerPoint. This will be detailed in steps later.
The file can also contain its own styling that will be used in the output file.
The input file must be uploaded to ADR as a data item of the "File” type.
The value of the input_pptx property can either be the name of a File item or a query using the filter syntax used throughout ADR. If a filter query is used, it must begin with “query=”. Some valid examples for the “input_pptx” property:
“myfile.pptx”
“A|i_name|eq|input.pptx”
“Nexus:query=A|i_date|gt|2022-02-03T17:35:00.000Z;A|i_name|eq|my_pptx_item;”.
output_pptx : The name of the output PowerPoint file to download as. Can be any string. Default is “<name-of-template>_<random_id>.pptx”.
[Optional] use_all_slides :
Property to enable the use of only specific slides from the input pptx file. Can be ‘1’ or ‘0’. Default is ‘1’.
If set to ‘0’, it must contain one or more child PPTX Slide Layout templates.
A PPTX Slide Layout template is used to represent a single slide that was chosen from the input pptx to be in the final output file. It needs the following property:
source_slide : The index position of the slide that must be picked, from the input pptx. For example, in order to pick the 8th slide for this PPTX Slide Layout template, set this property to ‘8’. The default is its own index position in the list of its parent’s children. For example, the first child uses the 1st slide from the input pptx, the second child uses the 2nd slide and so on.
In addition to this, PPTX Slide Layout Templates can also have their own filter queries set on them in order to filter the number of items being using inside themselves.
For example: If you’d like the output to only contain slide 7 and 8 from the input pptx, you would:
Create the parent PPTX Layout.
Set use_all_slides to ‘0’ on the parent PPTX Layout.
Create a child PPTX Slide Layout and set the source_slide to ‘7’.
Create a child PPTX Slide Layout and set the source_slide to ‘8’.
The source slides chosen by the child Slide layouts must be numerically ordered. Eg: ‘5’ for the first child, ‘8’ for the second child, ‘12’ for the third child and so on.
Creating the initial template file#
Create a pptx with desired styles and layouts.
Open the pptx file in PowerPoint. Go to View -> Slide Master.
Now, we must insert placeholders. This is to tell ADR what to insert into a slide and where it goes. To let ADR insert an image item into the placeholder, choose the target layout. Choose Insert Placeholder -> Picture. Now draw the placeholder wherever desired.
For a string item, HTML item, table of contents, link back to table of contents or breadcrumbs, Insert Placeholder -> Text.
For a movie/animation item, Insert Placeholder -> Media.
For a table/tree item, Insert Placeholder -> Table.
For a plot item, Insert Placeholder -> Chart.
For an image item, geometry/scene item or a file item, Insert Placeholder -> Picture.
Other item types are not supported at the moment.
Now, click Close Master View.
Create slides from these layouts.
Select a slide. Home -> Select -> Selection Pane...
You will see a list of placeholders and their names. Double click to edit.
ADR uses placeholder names (called selection label in PowerPoint) to decide what to insert in the placeholder.
Every placeholder name must begin with “Nexus:” in order to be recognized by ADR, followed by a very URL like syntax.
A Placeholder name MUST contain a query with the ADR filter syntax (used in Python APIs)
A placeholder name is a string that can contain the following placeholder parameters:
A query made with the ADR filter syntax must begin with “query=”.
Number of rows per slide to be set for a table item. Must be of the form “rows=n” where n is the number of rows.
Number of columns per slide to be set for a table item. Must be of the form “cols=n” where n is the number of columns.
Note: If there is a table inserted already, ADR will read the number of rows and columns from the table and use that as the limit.
Number of lines per slide to be set for a string item. Must be of the form “lines=n” where n is the number of lines. A string item containing multiple lines separated by a new line character is split into several lines and each line is used as a paragraph (bullet point in the PPT slide).
Placeholder parameters must be separated by “&”, just like in a URL.
Some valid examples:
“Nexus:query=A|i_name|eq|image_item”
“Nexus:query=A|i_date|gt|2022-02-03T17:35:00.000Z;A|i_name|eq|table;&rows=12&cols=6”.
Create as many as you like and save the file.
Upload the file as a File item to ADR and then set the item name or filter query as the “input_pptx” property of the PPTX Layout template.
Now, in the ADR interface, Reports -> Generate report...
You will see the PPTX Template render as a downloadable link to a pptx file. Click to download.
Download/export using the Python API#
Download pptx reports in a parent report:
get_pptx_from_report(report_guid, directory_name=None, query=None)
report_guid : The guid of the target report containing links to other pptx reports.
directory_name: The name of the directory to save the pptx files to. The filename of the pptx file(s) are taken from the template property ‘output_pptx’.
query: Query returning the initial set of items to process
Download a PPTX export directly:
export_report_as_pptx(report_guid, file_name, query=None)
report_guid : The guid of the report template to export as pptx.
file_name: Name of the file to save the pptx as. Required.
query: Query returning the initial set of items to process