Skip to content

docxtpl is a simple cli tool to generate docx from a docx template

License

Notifications You must be signed in to change notification settings

dorin-musteata/docxtpl

Repository files navigation

docxtpl

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.

Installation

Install with npm:

npm install -g docxtpl

Install with yarn:

yarn global add docxtpl

Usage

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"]

Example

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

Similar tools

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.

Contributing

Functionality can be added via submitting pull requests

Dependencies

About

docxtpl is a simple cli tool to generate docx from a docx template

Resources

License

Stars

Watchers

Forks

Packages

No packages published