Layout: PPTX#

Image

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:

  1. input_pptx :

    1. 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.

    2. A placeholder can be created using any pptx editor like Microsoft PowerPoint. This will be detailed in steps later.

    3. The file can also contain its own styling that will be used in the output file.

    4. The input file must be uploaded to ADR as a data item of the "File” type.

    5. 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:

      1. “myfile.pptx”

      2. “A|i_name|eq|input.pptx”

      3. “Nexus:query=A|i_date|gt|2022-02-03T17:35:00.000Z;A|i_name|eq|my_pptx_item;”.

  2. output_pptx : The name of the output PowerPoint file to download as. Can be any string. Default is “<name-of-template>_<random_id>.pptx”.

  3. [Optional] use_all_slides :

    1. Property to enable the use of only specific slides from the input pptx file. Can be ‘1’ or ‘0’. Default is ‘1’.

    2. If set to ‘0’, it must contain one or more child PPTX Slide Layout templates.

    3. 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:

      1. 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.

      2. 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.

    4. For example: If you’d like the output to only contain slide 7 and 8 from the input pptx, you would:

      1. Create the parent PPTX Layout.

      2. Set use_all_slides to ‘0’ on the parent PPTX Layout.

      3. Create a child PPTX Slide Layout and set the source_slide to ‘7’.

      4. Create a child PPTX Slide Layout and set the source_slide to ‘8’.

      5. 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#

  1. Create a pptx with desired styles and layouts.

  2. Open the pptx file in PowerPoint. Go to View -> Slide Master.

  3. 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.

    1. For a string item, HTML item, table of contents, link back to table of contents or breadcrumbs, Insert Placeholder -> Text.

    2. For a movie/animation item, Insert Placeholder -> Media.

    3. For a table/tree item, Insert Placeholder -> Table.

    4. For a plot item, Insert Placeholder -> Chart.

    5. For an image item, geometry/scene item or a file item, Insert Placeholder -> Picture.

    6. Other item types are not supported at the moment.

_images/6256665cd746dbae4a8842606f90ba8a9ebb1a42.png
  1. Now, click Close Master View.

  2. Create slides from these layouts.

_images/cf1c3a9a5ffce989ed3f7f287f1b83285d53caea.png
  1. Select a slide. Home -> Select -> Selection Pane...

_images/742ce3079216002188c243821c511e3b07bc88c9.png
  1. You will see a list of placeholders and their names. Double click to edit.

    1. ADR uses placeholder names (called selection label in PowerPoint) to decide what to insert in the placeholder.

    2. Every placeholder name must begin with “Nexus:” in order to be recognized by ADR, followed by a very URL like syntax.

    3. A Placeholder name MUST contain a query with the ADR filter syntax (used in Python APIs)

    4. A placeholder name is a string that can contain the following placeholder parameters:

      1. A query made with the ADR filter syntax must begin with “query=”.

      2. 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.

      3. 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.

      4. 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.

      5. 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).

    5. Placeholder parameters must be separated by “&”, just like in a URL.

    6. Some valid examples:

      1. “Nexus:query=A|i_name|eq|image_item”

      2. “Nexus:query=A|i_date|gt|2022-02-03T17:35:00.000Z;A|i_name|eq|table;&rows=12&cols=6”.

_images/22ee166a5048f1e38fba48d732800919287bcec5.png
  1. Create as many as you like and save the file.

  2. 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.

  3. Now, in the ADR interface, Reports -> Generate report...

  4. 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