Skip to content

Layout selector

The goal of this module is to take the ParsedTemplate data structure and turn it into the Template data structure.
We will later use this Template data to create the presentation.

Here are the main differences between them:

  • the ParsedTemplate is only a temporary data structure that is not stored in the database
  • the ParsedTemplate is closer to the original PowerPoint file, as it contains both slides and layouts
  • the Template data is a trimmed version of the ParsedTemplate, keeping only what is necessary for the presentation creation process
  • the ParsedTemplate still contains some PowerPoint internal values as-is (e.g. layout type), while the Template contains only our internal representation of similar things (e.g. a PowerPoint placeholder type subTitle becomes our internal SUBTITLE)

We could theoretically have included this directly as part of the file parser.
But we decided to separate them for multiple reasons:

  • easier maintenance thanks to a reduced module scope
  • we sometimes need the raw version of the template (e.g. previously, when we had a UI to configure custom templates, for internal template configuration validation purposes)

As part of the mapping from ParsedTemplate to Template, this module also determines which layout from the original file can be used and in which case.
We experimented with multiple ways of doing this automatically, but we ended up relying on manual configuration made directly in the PowerPoint file.
The main way to configure this in the template file is through naming conventions, mainly applied to layouts and placeholders.

When creating the template file, the designer must follow a set of rules to make it compatible with the system, for example:

  • naming a layout SS_ITEMS_3 will be interpreted by the system as a layout of type ITEMS, made for 3 items
  • naming a placeholder SS_ITEM_1_TITLE will be interpreted by the system as a placeholder for the title of the first item

More details about this can be found here.