Get started with docxtemplater CDN

(MIT OR GPL-3.0) licensed

Docxtemplater: Node.js library for filling DOCX merge fields with dynamic content.

Tags:
  • docx
  • templates
  • generation
  • microsoft word

Stable version

Copied!

How to start using docxtemplater CDN


const Docxtemplater = require('docxtemplater');
const fs = require('fs');

// Load the template from a file
const templateBuffer = fs.readFileSync('template.docx', 'binary');
const template = new Docxtemplater(templateBuffer);

// Prepare the data to fill in the template
const context = { name: 'John Doe' };

// Render the template with the data
template.render({ doc: { properties: { author: 'Your Name' } } }, context, function (err, doc) {
  if (err) {
    console.log('Error:', err);
    return;
  }

  // Save the generated document to a file
  fs.writeFileSync('output.docx', doc.getZip().generate({ type: 'nodebuffer' }));
  console.log('Document generated successfully.');
});
Copied!
Copied!

All versions

0.3.0 0.3.1 0.3.2 0.3.3 0.4.0 0.4.1 0.4.2 0.4.3 0.4.4 0.4.5 0.4.6 0.4.7 0.4.8 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.5.8 0.5.9 0.6.0 0.6.1 0.6.2 0.6.3 0.6.4 0.7.0 0.7.1 0.7.2 0.7.3 0.7.4 0.7.5 0.7.6 0.7.7 1.0.0 1.0.0-beta 1.0.0-beta.2 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.2.0 1.2.1 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 3.0.0 3.0.11 3.0.12 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.10.1 3.11.0 3.11.1 3.11.2 3.11.3 3.11.4 3.12.0 3.13.0 3.13.1 3.13.2 3.13.3 3.13.4 3.13.5 3.13.6 3.14.0 3.14.1 3.14.10 3.14.2 3.14.3 3.14.4 3.14.5 3.14.6 3.14.7 3.14.8 3.14.9 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.0 3.16.1 3.16.10 3.16.11 3.16.2 3.16.3 3.16.4 3.16.5 3.16.6 3.16.7 3.16.8 3.16.9 3.17.0 3.17.1 3.17.2 3.17.3 3.17.4 3.17.5 3.17.6 3.17.7 3.17.8 3.17.9 3.18.0 3.19.0 3.19.1 3.19.10 3.19.2 3.19.3 3.19.4 3.19.5 3.19.6 3.19.7 3.19.9 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.20.0 3.20.1 3.21.0 3.21.1 3.21.2 3.22.0 3.22.1 3.22.2 3.22.3 3.22.4 3.22.5 3.22.6 3.22.7 3.22.8 3.23.0 3.23.1 3.23.2 3.24.0 3.25.0 3.25.1 3.25.2 3.25.3 3.25.4 3.25.5 3.26.0 3.26.1 3.26.2 3.26.3 3.26.4 3.27.0 3.27.1 3.27.2 3.28.0 3.28.1 3.28.2 3.28.3 3.28.4 3.28.5 3.28.6 3.29.0 3.29.1 3.29.2 3.29.3 3.29.4 3.29.5 3.3.0 3.3.1 3.30.0 3.30.1 3.30.2 3.30.3 3.31.0 3.31.1 3.31.2 3.31.3 3.31.4 3.31.5 3.31.6 3.32.0 3.32.1 3.32.2 3.32.3 3.32.4 3.32.5 3.32.6 3.33.0 3.34.0 3.34.1 3.34.2 3.34.3 3.35.0 3.35.1 3.36.0 3.36.1 3.37.0 3.37.1 3.37.10 3.37.11 3.37.12 3.37.13 3.37.14 3.37.2 3.37.3 3.37.4 3.37.5 3.37.6 3.37.7 3.37.8 3.37.9 3.38.0 3.39.0 3.39.1 3.39.2 3.4.0 3.4.1 3.4.2 3.4.3 3.40.0 3.40.1 3.40.2 3.40.3 3.41.0 3.42.0 3.42.1 3.42.2 3.42.3 3.42.4 3.42.5 3.42.6 3.42.7 3.43.0 3.43.1 3.44.0 3.45.0 3.45.1 3.46.0 3.46.1 3.46.2 3.47.0 3.47.1 3.47.2 3.47.3 3.47.4 3.48.0 3.49.0 3.49.1 3.49.2 3.5.0 3.5.1 3.5.2 3.50.0 3.51.0 *** 3.51.1 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9