npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docxtemplater

v3.47.0

Published

Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js, the Browser and the command line

Downloads

349,312

Readme

docxtemplater

Note If you love docxtemplater, please help us spread your trust in docxtemplater by leaving us a video or text testimonial

Download count Current tag CDNJS version size gzip size

docxtemplater is a library to generate docx/pptx documents from a docx/pptx template. It can replace {placeholders} with data and also supports loops and conditions. The templates can be edited by non-programmers, for example your clients.

docxtemplater is very robust because of the many fixed issues over the years, and the high quality of tests and code.

Features

Demo Site

  • Replace a {placeholder} by a value
  • Use loops: {#users} {name} {/users}
  • Use loops in tables to generate columns
  • Use conditions (if users.length>3) with angular Parsing
  • Insert custom XML {@rawXml} (for formatted text for example)

Quickstart

Documentation

The full documentation of the latest version can be found here.

See CHANGELOG.md for information about how to migrate from older versions.

Modules

Functionality can be added with the following paid modules :

  • Image module to add a given image with the syntax: {%image};
  • Html Module to insert formatted text in a docx document with the syntax {~html};
  • XLSX Module to be able to do templating on Excel files (xlsx extension), also with loops and conditions;
  • Chart Module to replace a chart by using data from the JSON object that you give with the syntax {$chart};
  • Html-Pptx Module to insert formatted text in a pptx document with the syntax {~html};
  • Error Location Module to show the errors in the template using Word comments
  • Slides Module to create multiple slides dynamically with the syntax {:users};
  • Subtemplate Module to include an external docx file inside a given docx file with the syntax {:include doc};
  • Subsection Module to include subsections (headers/footers) from an other document with the syntax {:subsection doc};
  • Subtemplate-pptx Module to include an external pptx file inside a given pptx file with the syntax {:include doc};
  • Word-Run Module to include raw runs (<w:r>) inside the document with the syntax {r@wrun}. This makes it possible to include styled text without having to remove the enclosing paragraph like in the {@rawXml} tag;
  • QrCode Module to replace an image, keeping any existing properties;
  • Table Module to create tables from two dimensional data using the syntax {:table data};
  • Meta Module to make a document readonly, add a text watermark or update the margins;
  • Styling Module restyle a paragraph, a cell or a table depending on some data using the syntax {:stylepar style};
  • Footnotes Module to be able to add footnotes to a document using the syntax {:footnotes foot}
  • Paragraph Placeholder Module to simplify conditions that should show or hide a given paragraph using the syntax {?tag}

About docxtemplater

Docxtemplater is my main job, and has been maintained for over 8 years. Expect to get great support if you buy any modules, and also good support on the open-source version.