This is a tool for inserting a placeholder in Word or PowerPoint, where the placeholder is linked to the actual table that is inserted afterwards. This feature can be combined with the feature to insert a table, and thus connect the logic. Read more about combining the features here.
The configuration of the table placeholder can seem to be a bit complex, but this article seeks to elaborate each element in the configuration.
How does it work?
The feature simply opens an interface in which the user can decide which components to include. Here is an example of the interface:
When clicking OK, the placeholder will be inserted with the components that are checked.
The configuration behind this consist of 1) a JSON file where the content for the interface is defined, 2) a template containing the placeholder components, 3) a module with a command to insert the placeholder (this is the button that opens the interface), and 4) the latest BaseExtensions
plugin.
1) JSON file
The content in the interface can be broken down to the following:
The QuestionGroup
is referred to as PlaceholderQuestionGroups
in the JSON, and is the group of components. The BooleanQuestion
is referred to as Toggles
in the JSON, which is the components in the group. In the interface above, there is only one group and four toggles, but it can be configured to consist of several groups and toggles if needed.
Location and naming of JSON file
The JSON file should be located in the Content
folder in the SDUP as the command to insert a placeholder searches in here for the defined folder path. There must be separate JSON files for Word and PowerPoint named Word.json
and PowerPoint.json
.
Configuration of JSON file
As mentioned, the content for the interface is defined in JSON file, which includes groups and toggles that should be present. The JSON for the interface used as an example is shown below. Here, there is one PlaceholderQuestionGroups
in which the toggles are defined.
Each element has a Key
and a Title
, where the key is to be used in the template and module, while the title is whatever should be written in the interface. Further, each toggle has a parameter called DefaultValue
that can be either true
or false
, depending on whether it should be checked as default when the interface opens.
{
"PlaceholderQuestionGroups": [
{
"Key": "Components",
"Title": "Supporting components to include",
"Toggles": [
{
"Key": "TableHeading",
"Title": "Table heading",
"DefaultValue": true
},
{
"Key": "Source",
"Title": "Source",
"DefaultValue": true
},
{
"Key": "TableSubheading",
"Title": "Table subheading",
"DefaultValue": false
},
{
"Key": "Notes",
"Title": "Notes",
"DefaultValue": false
}
]
}
]
}
2) Template
Each placeholder must have a template, where the placeholder and its elements are present. In Word, we use content controls as elements, while we use shapes in PowerPoint. The template must be configured in either Word or PowerPoint, and the document or presentation should contain nothing but the elements for the placeholder, as the command to insert a placeholder will insert everything present in the targeted template.
Location and naming of template
The template should be located in the Content
folder in the SDUP as the command to insert a placeholder searches in here for the defined folder path. Further, it should be located next to the JSON file. The template for Word must be named Word.docx, while the template for PowerPoint must be named PowerPoint.pptx.
Configuration of template
The elements should be linked to the toggles in the JSON file using the key for the group and the key for the toggle concerned separated with a dot, e.g. QuestionGroup.BooleanQuestion
. This should be the name for the content control in Word and the shape in PowerPoint. As an example, the content control or shape that is the element for the table heading should be named Components.TableHeading
as Components
is the key for the group, while TableHeading
is the key for the toggle concerned. The element named Master
is where the table should be inserted.
This is an example of a Word template:
This is an example of a PowerPoint template:
3) Module
In the module, we use the command that opens the interface and inserts the placeholder. Further, we add a parameter in which the path for the template is defined. The command searches in the Content
folder for the defined folder path where the configuration JSON file and template file are located in.
CMD
<Cmd case="BaseExtensions:insert-placeholder" templatePath="X">
The templatePath
should only point to the folder where the templates and JSONs are in, e.g. if the files are located in the following path:
Content\BaseExtensions\Placeholders\Template1
...the parameter must have the following value:
templatePath="Placeholders/Template1"
Configuration of module
Inside the command, we add an element called <Select/>
which contain the elements with the names of the content controls/shapes that should be selected. Inside these, we can add commands that should be applied to the respective content controls/shapes.
<Button label="Insert placeholder">
<Cmd case="BaseExtensions:insert-placeholder" templatePath="Placeholders/Template1"> <Select> <Components.TableHeading> <Cmd case="".../> </Components.TableHeading> <Components.TableSubheading> <Cmd case="".../> </Components.TableSubheading> <Components.Source> <Cmd case="".../> </Components.Source> <Components.Notes> <Cmd case="".../> </Components.Notes> </Select> </Cmd> </Button>
4) Plugin
Get the latest BaseExtensions
plugin by right-clicking at the SDUP folder, selecting OfficeExtensions and then Upgrade BaseExtensions.
Reposition to master
When the command "Insert placeholder"
, it will, in PowerPoint, save position information to each shape relatively to a shape containing the word "Master". If no shape is named "Master", it will not save the position information, and thus it will not be able to reposition.
This is a second command that enables the user to reposition the placeholder elements, when the Master shape (the table) is resized or moved.
CMD
<Cmd case="BaseExtensions:reposition-to-master-shape"/>
The command works only in PowerPoint.
Comments
0 comments
Article is closed for comments.