docxtpl is a simple cli tool to generate docx from a docx template by replacing {placeholders}
with data provided from a json file. It uses
docxtemplater and pizzip under the hood.
Install with npm:
npm install -g docxtpl
Install with yarn:
yarn global add docxtpl
Usage: -t <template> -i <input> -o <output>
Options:
--help Show help [boolean]
--version Show version number [boolean]
-t, --template Template variables [.json] [string] [required]
-i, --input Template source [.docx] [string] [default: "source.docx"]
-o, --output Tempalte output [.docx] [string] [default: "output.docx"]
docxtpl -t template.json -i template.docx -o final.docx
Will take template.json as variables list and will replace all placeholders in template.docx resulting in a output final.docx with replaced variables
More exmaples complies with docxtemplater
There are a few libraries that work the same way:
- docxtpl : Python. Uses jinja2 template syntax , doesn't provide an easy way to use landscape documents.
Functionality can be added via submitting pull requests