docxtemplater-link-module
Hyperlink module for docxtemplater
Installation:
You will need docxtemplater v2.1.1: npm install docxtemplater
Install this module: npm install docxtemplater-link-module
Usage: Text and URL
The example below will displays the following hyperlink:
Lorem ipsum dolor sit amet.
Your docx should contain the text: Lorem ipsum {^link} amet.
.
var fs = ;var content = fs;var DocxGen = ;var LinkModule = ;var linkModule = ; var docx = ;var buffer = docx ;fs;
Usage: URL only
The example below will displays the following hyperlink:
Lorem ipsum http://google.com amet.
Your docx should contain the text: Lorem ipsum {^link} amet.
.
var fs = ;var content = fs;var DocxGen = ;var LinkModule = ;var linkModule = ; var docx = ;var buffer = docx ;fs;
Usage: Email address support
The example below will displays the following hyperlink:
Lorem ipsum john.smith@example.com amet.
Your docx should contain the text: Lorem ipsum {^link} amet.
.
var fs = ;var content = fs;var DocxGen = ;var LinkModule = ;var linkModule = ; var docx = ;var buffer = docx ;fs;
Usage: Text and URL in powerpoint pptx
The example below will displays the following hyperlink powerpoint:
Lorem ipsum dolor sit amet.
Your pptx should contain the text: Lorem ipsum {^link} amet.
.
var fs = ;var content = fs;var DocxGen = ;var LinkModule = ;var linkModule = ; var docx = ;var buffer = docx ;fs;
Usage: Email address support in powerpoint
The example below will displays the following hyperlink:
Lorem ipsum john.smith@example.com amet.
Your pptx should contain the text: Lorem ipsum {^link} amet.
.
var fs = ;var content = fs;var DocxGen = ;var LinkModule = ;var linkModule = ; var docx = ;var buffer = docx ;fs;
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