Replacements and options applied to templates are defined with the parameter "-d" and a JSON file. To indicate the DOCX document that will work as a template use the parameter "-t":
dynadocx -d data.json -t template.docx
The following is the complete set of key/values admitted with their default values:
{
"template": {
"remove_placeholders": false,
"replace_checkboxes": [
{
"placeholders": [
""
],
"values": [
""
],
"options": {
"content_type": "all",
"max_replacements": ""
}
}
],
"replace_lists": [
{
"placeholders": [
""
],
"values": [
[
""
]
],
"options": {
"content_type": "all",
"max_replacements": ""
}
}
],
"replace_tables": [
{
"placeholders": [
[
""
]
],
"values": [
[
[
""
]
]
],
"options": {
"content_type": "all",
"max_replacements": ""
}
}
],
"replace_texts": [
{
"placeholders": [
""
],
"values": [
""
],
"options": {
"content_type": "all",
"max_replacements": ""
}
}
]
}
}
Detail of available options
remove_placeholders
If true, it deletes the document placeholders. This option is the last one to be executed in order to avoid erasing placeholders needed to be replaced with the rest of options.
replace_checkboxes
Check and uncheck checkboxes (content control and legacy form field).
key | value |
---|---|
placeholders | Placeholder names, without ${ }. Placeholders are assigned in the checkbox properties in the Tag (content control checkboxes) and in the Help Text (legacy form field checkboxes). To check these properties in some MS Word versions it may be necessary to enable Design Mode. |
values | New values: true (checked) or false (unchecked). Each value matches a placeholder of the previous key (placeholders) depending on its position. |
content_type | Content type to replace the placeholder: all, document, headers, footers, footnotes, endnote, comments. |
max_replacements | Not zero-based, replaces first N matches. If not set, replace all. |
replace_lists
Replace placeholders by text values cloning the list.
key | value |
---|---|
placeholders | Placeholder names, without ${ }. Each set of values matches an existing placeholder in the list designed to be cloned and replaced. |
values | New values. Each set of values matches the placeholders of every cloned list of the previous key (placeholders). |
content_type | Content type to replace the placeholder: all, document, headers, footers, footnotes, endnote, comments. |
max_replacements | Not zero-based, replaces first N matches. If not set, replace all. |
replace_tables
Replace placeholders by text values cloning the rows.
key | value |
---|---|
placeholders | Placeholder names, without ${ }. Each set of values matches the existing placeholders in the row set to be cloned and replaced. |
values | New values. Each set of values matches the placeholders of every row cloned of the previous key (placeholders). |
content_type | Content type to replace the placeholder: all, document, headers, footers, footnotes, endnote, comments. |
max_replacements | Not zero-based, replaces first N matches. If not set, replace all. |
replace_texts
Replaces placeholders by text values.
key | value |
---|---|
placeholders | Placeholder names, without ${ }. Every placeholder to be replaced must have a value assigned in the following key (values). |
values | New values. Every values matches a placeholder of the previous key (placeholders) depending on its position. |
content_type | Content type to replace the placeholder: all, document, headers, footers, footnotes, endnote, comments. |
max_replacements | Not zero-based, replaces first N matches. If not set, replace all. |