JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33
  • Score
    100M100P100Q60028F
  • License MIT

Hyperlink module for docxtemplater

Package Exports

  • docxtemplater-link-module

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (docxtemplater-link-module) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

docxtemplater-link-module

Hyperlink module for docxtemplater

Installation:

You will need docxtemplater v1: npm install docxtemplater

install this module: npm install docxtemplater-link-module

Usage

Your docx should contain the text: {^chart}

var fs = require('fs');
var LinkModule = require('docxtemplater-link-module');
var linkModule = new LinkModule();
 
var docx = new DocxGen()
  .attachModule(linkModule)
  .load(content)
  .setData({
    link : {
      text : "link to Google",
      url : "http://google.com"
    }
    }).
    render();
var buffer = docx
  .getZip()
  .generate({type:"nodebuffer"});
 
fs.writeFile("test.docx", buffer);

Testing

You can test that everything works fine using the command mocha. This will also create 2 docx files under the root directory that you can open to check if the docx are correct