Generate docx, pptx, xlsx or odt from inside your
application with {tags} using Javascript
import Docxtemplater from "docxtemplater";
const doc = new Docxtemplater(document1);
doc.render({ firstname: "John" });
import Docxtemplater from "docxtemplater";
const doc = new Docxtemplater(presentation1);
doc.render({ title: "Lorem ipsum" });
import Docxtemplater from "docxtemplater";
const doc = new Docxtemplater(spreadSheet1);
doc.render({
items: [
{
description: "description...",
unit_price: 200,
quantity: 18,
},
],
});
| Description | Unit price | Quantity | |
|---|---|---|---|
| {#items}{description} | {unit_price} | {quantity} | {/items} |
Paid version trusted by 800+ companies since 2017






























Docxtemplater is a JavaScript library that generates Word (.docx), PowerPoint (.pptx), Excel (.xlsx) and OpenDocument (.odt) documents from templates filled with structured data such as JSON. Core features include text replacement, loops, and conditions, while optional modules add capabilities like image insertion, HTML content, charts, tables, Excel templating, footnotes, search/replace text. It runs in Node.js and in the browser, making it easy to embed document generation into any application. Docxtemplater is designed for developers to integrate document generation into applications, while allowing non-programmers (e.g. business users using Word/Office) to design and edit the templates.
Docxtemplater relies on a template-based approach: anyone who knows how to use Word can modify the look of the generated documents.
You can let your own customers edit the Word template!
With Docxtemplater, you write a document template using Word or PowerPoint and fill it with tags such as {user}. You can call Docxtemplater using Node.js or in the browser with Javascript. The engine takes your JSON data and generates a document with all fields replaced by their values.
Every paid license includes email support within 48 hours to help resolve any issues.
For the ENTERPRISE Plan, the response time is 24 hours.
Open-source users receive active support on the GitHub issue tracker .
In a few minutes you can install docxtemplater on npm, create your first template and generate some DOCX files from Javascript objects or JSON.
Docxtemplater has an open-source core with all commonly needed features.
For more advanced features, we sell 19 paid modules that you can purchase individually or in a pack of 4 (PRO Plan), or all modules (ENTERPRISE Plan)
Docxtemplater is tested with all active Node.js versions 12 through 24, and in all common browsers (Chrome, Firefox, Safari, IE9+).
Add images using the simple syntax:
{%image}The image can be loaded from base64, from the filesystem or from an http request.
With Docxtemplater, you can generate tables from HTML, from a simple loop, from a loop that creates multiple columns. You can also style a table cell dynamically
Add HTML with
{~html}This allows you to use the input from your WYSIWYG editor and put it into your report.
Or to generate a complex table.
You can manage multiple docx documents and then include multiple documents in your final document.
Usage is like this:
Title
{:include subdoc}
Other
With the ENTERPRISE plan, we provide a docker image. It allows you to use Docxtemplater from other languages such as Python, Java, Go, C#, C++, Ruby, PHP, Node.js (we've built an SDK for each language)
Docxtemplater is highly customizable:
{user.name | upper } or {#companies | where:'revenue > 1000'}[[user]] instead of {user}Docxtemplater works with the 3 major office document formats :
The open-source core supports only DOCX and PPTX; for XLSX support, you need the XLSX Module.
Docxtemplater has extensive documentation to get started (in Node.js or the browser), and configure the generation.
For questions about our paid modules, see our commercial FAQ and our technical FAQ.
For each feature, we write a full suite of tests with real Word documents to ensure that the generated documents are correct. Our current mutation testing score measured by Stryker Mutator is at 90%, which is very high and allows us to develop features without fearing of breaking existing use cases.
Add charts using the simple syntax:
{$myChart}Insert a chart to define your style, and put a tag to bind the data to your chart.
Use the error location module to get a commented document highlighting all errors in your template, making it much easier to fix issues in your template for your end-users and for long documents.
Use the meta module to programmatically search("Text"), replaceAll("Pattern", "Replacement"), mark document as readonly, add watermarks or programmatically retrieve, edit and create comments.
With the styling module, you can modify the background-color of a cell based on a condition, modify the font-size, color of a paragraph, the style of a shape.
3 minutes
Yes. You can test all features on our live interactive demo, where you can experiment with paid modules (like HTML or Images) and upload your own templates.
While we do not offer a downloadable trial version, we provide a 14-day, 100% money-back guarantee so you can try Docxtemplater risk-free in your own environment. If you need a deep dive, you can either send us your questions by email or schedule a video call
Docxtemplater has an open-source core that includes all standard text, loop, and conditional templating features. Advanced capabilities are split into separate paid modules (for example, the HTML module for rich text insertion, or the Image module).
You can acquire these features in two ways:
Yes, the license model is suitable for Software as a Service businesses. As long as you are the entity running Docxtemplater software, you can use the standard licenses.
If you need to redistribute the software by installing it on your customers' servers, this will need a specific "APPLIANCE" license. The standard license does not allow you to redistribute the software. The Appliance license plan is 6500€ per year for PRO and 15000€ per year for ENTERPRISE version. It allows you to distribute the modules contained in the PRO or ENTERPRISE module as part of your application. You are not allowed to resell the modules as is.
You will get direct email support included with any Plan or Module purchase. We typically respond within 24 business hours to answer your questions and help with implementation. Bug fixes are fully covered under your plan. If you request a new feature, we evaluate it based on its utility to the broader user base and the development effort required.
To help us resolve your issue faster, please include your template, JSON data, relevant code, the modules you are using, and the expected or generated output when you contact support.
The modules are installed via npm, you'll have to run : npm install --save <secret-url> That url will be unique for your account.
The compiled files for browser usage are also bundled inside the package.
It is not possible to convert docx to PDF with Docxtemplater, because Docxtemplater is a templating engine and doesn’t know how to render a given document. We recommend using libreoffice headless for a free tool or PDFTron for a paid alternative.
Read our commercial FAQ and technical FAQ or contact us for other questions.