Here are documented the special options that you can set when creating a new DocxGen to get some more superpower :

It documents the options parameter when you do:

var doc=new DocxGen(content);

Image Replacing


The imageReplacing feature has been removed from the main docxtemplater package. This feature will be implemented in the future in an external module.

Custom Parser

The name of this option is parser (function).

With a custom parser you can parse the tags to for example add operators like ‘+’, ‘-‘, or whatever the way you want to parse expressions. See for a complete reference of all possibilities of angularjs parsing:

To enable this, you need to specify a custom parser. You need to create a parser function:

docxtemplater comes shipped with this parser:

    return {
        get:function(scope) {
            if (expression===".") return scope;
            return scope[expression]

To use the angular-parser, do the following:

expressions= require('angular-expressions');
// define your filter functions here, eg:
// expressions.filters.split = function(input, str) { return input.split(str); }
angularParser= function(tag) {
    return {
        get: tag == '.' ? function(s){ return s;} : expressions.compile(tag)
new DocxGen(data).setOptions({parser:angularParser})


The require() works in the browser if you include vendor/angular-parser-browser.js

Intelligent LoopTagging

The name of this option is intelligentTagging (boolean).

When looping over an element, docxtemplater needs to know over which element you want to loop. By default, it tries to do that intelligently (by looking what XML Tags are between the {tags}). However, if you want to always use the <w:t> tag by default, set this option to false.

You can always specify over which element you want to loop with the dash loop syntax