Demo Readme Changelog Buy styling module Releases RSS

Summary (version 3.1.0)

This module makes it possible to edit style of table cells or paragraphs conditionnaly (background-color, ...).

This module is available as part of the docxtemplater ENTREPRISE plan.

README

Style Module

This module exposes multiple tags to dynamically change the style of a given paragraph or table cell for example.

The current tags are :

  • {:stylecell style} To style a cell
  • {:stylepar style} To style a paragraph

Installation:

You will need docxtemplater v3: npm install docxtemplater

Install this module with npm install --save "$url"

Usage

Your docx should contain the text: {:stylecell style}. You can find a working sample at ./sample.js

doc.setData({
    style: {
        cellBackground: "#00ff00",
        textColor: "white"
        fontFamily: "Calibri"
    }
})

Building

You can build the es6 into js by running npm run compile

Testing

You can test the module with npm test

CHANGELOG

3.1.0

  • Add the {:stylepar style} tag to change the paragraph style

  • Add support for fontFamily: "Calibri"

  • Refactor module.prefix into an object {cell: ':stylecell', paragraph: ':stylepar'}

3.0.0

Initial release

Edgar Hipp

I'm the creator of docxtemplater. I work on making docxtemplater great since 2013.