Adding contents
Create a file or URL with the HTML/CSS content to be added to the document:
<style>
p {
font-size: 12px;
font-family: Arial;
}
</style>
<p>Hello world</p>
Generate a DOCX adding its HTML/CSS as input:
dynadocx -i content.html -o document_output.docx
Apply settings
Create a file or URL with JSON format with the settings to be applied:
{
"design": {
"page": {
"color": "DEEAF6"
}
}
}
Generate a DOCX, adding JSON as data:
dynadocx -i content.html -d design.json -o document_output.docx
Using a template
Create a new DOCX using MS Word, LibreOffice, Google Docs or any other DOCX editor, with one or more placeholders (variables). The format to define a placeholder (variable) in a DOCX is ${VAR}.
Create a file or URL with JSON format with the replacements to be done:
{
"template": {
"replace_texts": [
{
"placeholders": [
"VAR_1",
"VAR_2",
],
"values": [
"New value 1",
"New value 2",
]
}
]
}
}
Generate a DOCX with JSON as data and stating the template to be used:
dynadocx -d data.json -t template.docx -o document_output.docx