Generate docx documents from templates, in Node or in the browser
open sourceMITself-hostablefree
easy-template-x fills Word (.docx) templates with JSON data in Node.js or the browser, keeping the template's styling. Its syntax is deliberately small, {tag} and {#loop}...{/loop}, so people who don't program can write templates, and tags can contain spaces and any alphabet. Bundled plugins handle text, loops over text, table rows, table columns and list items (with simple conditions), images, hyperlinks, charts and raw XML, and you can write your own plugins or resolvers (such as Angular-style expressions). It's MIT-licensed; its author also runs templatedocs.io, a hosted document automation service.
Problems it solves
- a Word template syntax simple enough for school teachers to write themselves
- put images, hyperlinks and charts into a generated .docx without paying for add-on modules
- repeat table columns, not just rows, when filling a Word template from JSON
- Word template tags written in Hebrew or Arabic, with spaces in the tag names
- fill a .docx in the browser from a Blob and let the user download it
- update the data behind a chart in a Word template from JavaScript
- list every tag in a Word template so our app knows which fields to ask for
Features
- {tag} and {#loop}{/loop} syntax with customisable delimiters
- loops over text, table rows, table columns and list items, with simple conditions
- image plugin: replace a text tag or a placeholder image
- link plugin for hyperlinks
- chart plugin to update chart data
- raw XML plugin
- custom plugins and custom resolvers (Angular-style expressions via an extension)
- list a template's tags
- tags with spaces and any Unicode alphabet
- Blob, Buffer and ArrayBuffer input in Node and the browser
Capabilities
| Takes plugins | plan not known |
|---|
Alternatives
The same job
These do what easy-template-x does.
- Carbone Generates PDF, DOCX and other documents from JSON data and Office templates
- docxtemplater Powerful Word, PowerPoint and Excel generation
- Sablon Ruby document template processor based on docx templates and Mail Merge fields
- docx-templates Template-based docx report creation for both Node and the browser
- docxtpl Use a docx as a jinja2 template
- Adobe PDF Services API Modern cloud-based capabilities for PDF manipulation.