Demo
Readme
Changelog
Releases RSS Feed
Compatibility : nodejs and browser

Summary (version 3.0.6) Buy footnotes module

This module exposes a tag to add a footnote to the document

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

README

Installation:

You will need docxtemplater npm install docxtemplater

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

Usage

Your docx should contain the text: {:footnote foot}

var FootnoteModule=require('docxtemplater-footnote-module')
var opts = {};
var footnoteModule=new FootnoteModule(opts);

var zip = new JSZip(content);
var docx=new Docxtemplater()
    .attachModule(footnoteModule)
    .loadZip(zip)
    .setData({foot:'The text of the footnote'})
    .render();

var buffer= docx
        .getZip()
        .generate({type:"nodebuffer", compression: "DEFLATE"});

fs.writeFile("test.docx",buffer);

After installing the module, you can use a working demo by running node sample.js.

Customization

It is possible to customize how footnotes look like with the refProperties option.

For example, to have the numbers in the footnotes section written in superscript, you can do :

var footnoteModule=new FootnoteModule({
    refProperties: '<w:vertAlign w:val="superscript"/>'
});

Building in the browser

You can build a release for the browser with the following commands

npm install
npm run preversion

You will have build/footnotemodule.js.

CHANGELOG

3.0.6

  • Move docxtemplater from devDependencies to dependencies

Explanation : On some versions of npm (notably 5.8.0), when having a package containing docxtemplater-footnotes-module, the installation will generate a tree of node_modules that puts the module on a level where it has no access to docxtemplater. By explicitly asking it as a dependency, this issue is avoided.

3.0.5

  • Make module compatible with docxtemplater version 3.5 and below.

Explanation : Recently, the scopemananger API (internal API) has changed, this new version of the footnotes module makes the module work with both versions newer than 3.6 and older than 3.6 of docxtemplater.

3.0.4

Add meta context argument to custom parser with information about the tag for each types of tags

3.0.3

Make it possible to style footnotes with option refProperties

3.0.2

Mark package as private in package.json

3.0.1

It now works even if some footnotes already exist (if word/footnotes.xml exists)

3.0.0

Initial release.

Edgar Hipp

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