{"id":24331171,"url":"https://github.com/sujith3g/docxtemplater-link-module","last_synced_at":"2025-09-27T17:30:58.139Z","repository":{"id":45570471,"uuid":"51251288","full_name":"sujith3g/docxtemplater-link-module","owner":"sujith3g","description":":anchor: Hyperlink module for docxtemplater","archived":false,"fork":false,"pushed_at":"2017-11-08T16:26:26.000Z","size":301,"stargazers_count":22,"open_issues_count":5,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T06:35:32.386Z","etag":null,"topics":["docx","docxtemplater","hyperlinks","powerpoint","pptx","template-engine"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/docxtemplater-link-module","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sujith3g.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-07T14:55:14.000Z","updated_at":"2024-11-03T22:23:51.000Z","dependencies_parsed_at":"2022-08-01T01:07:57.898Z","dependency_job_id":null,"html_url":"https://github.com/sujith3g/docxtemplater-link-module","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujith3g%2Fdocxtemplater-link-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujith3g%2Fdocxtemplater-link-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujith3g%2Fdocxtemplater-link-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujith3g%2Fdocxtemplater-link-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sujith3g","download_url":"https://codeload.github.com/sujith3g/docxtemplater-link-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234448542,"owners_count":18834248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docx","docxtemplater","hyperlinks","powerpoint","pptx","template-engine"],"created_at":"2025-01-18T01:18:30.123Z","updated_at":"2025-09-27T17:30:52.880Z","avatar_url":"https://github.com/sujith3g.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# docxtemplater-link-module\nHyperlink module for [docxtemplater](https://github.com/open-xml-templating/docxtemplater)\n\n[![Download count](https://img.shields.io/npm/dt/docxtemplater-link-module.svg?style=flat)](https://www.npmjs.org/package/docxtemplater-link-module)\n[![ghit.me](https://ghit.me/badge.svg?repo=sujith3g/docxtemplater-link-module)](https://ghit.me/repo/sujith3g/docxtemplater-link-module)\n[![Build Status](https://travis-ci.org/sujith3g/docxtemplater-link-module.svg?branch=master)](https://travis-ci.org/sujith3g/docxtemplater-link-module)\n\n## Installation:\nYou will need docxtemplater v2.1.1: `npm install docxtemplater`\n\nInstall this module: `npm install docxtemplater-link-module`\n\n## Usage: Text and URL\n\nThe example below will displays the following hyperlink:\n\u003e Lorem ipsum [dolor sit](http://google.com) amet.\n\nYour docx should contain the text: `Lorem ipsum {^link} amet.`.\n\n```js\nvar fs = require('fs');\nvar content = fs.readFileSync(__dirname + \"/example-href.docx\", \"binary\");\nvar DocxGen = require('docxtemplater');\nvar LinkModule = require('docxtemplater-link-module');\nvar linkModule = new LinkModule();\n \nvar docx = new DocxGen()\n\t.attachModule(linkModule)\n\t.load(content)\n\t.setData({\n\t\tlink : {\n\t\t\ttext : \"dolor sit\",\n\t\t\turl : \"http://google.com\"\n\t\t}\n\t}).\n\trender();\nvar buffer = docx\n\t.getZip()\n\t.generate({type:\"nodebuffer\"});\nfs.writeFile(\"test.docx\", buffer);\n```\n\n## Usage: URL only\n\nThe example below will displays the following hyperlink:\n\u003e Lorem ipsum [http://google.com](http://google.com) amet.\n\nYour docx should contain the text: `Lorem ipsum {^link} amet.`.\n\n```js\nvar fs = require('fs');\nvar content = fs.readFileSync(__dirname + \"/example-href.docx\", \"binary\");\nvar DocxGen = require('docxtemplater');\nvar LinkModule = require('docxtemplater-link-module');\nvar linkModule = new LinkModule();\n \nvar docx = new DocxGen()\n\t.attachModule(linkModule)\n\t.load(content)\n\t.setData({\n\t\tlink : \"http://google.com\"\n\t}).\n\trender();\nvar buffer = docx\n\t.getZip()\n\t.generate({type:\"nodebuffer\"});\nfs.writeFile(\"test.docx\", buffer);\n```\n\n## Usage: Email address support\n\nThe example below will displays the following hyperlink:\n\u003e Lorem ipsum [john.smith@example.com](mailto:john.smith@example.com) amet.\n\nYour docx should contain the text: `Lorem ipsum {^link} amet.`.\n\n```js\nvar fs = require('fs');\nvar content = fs.readFileSync(__dirname + \"/example-mailto.docx\", \"binary\");\nvar DocxGen = require('docxtemplater');\nvar LinkModule = require('docxtemplater-link-module');\nvar linkModule = new LinkModule();\n \nvar docx = new DocxGen()\n\t.attachModule(linkModule)\n\t.load(content)\n\t.setData({\n\t\tlink : \"john.smith@example.com\"\n\t}).\n\trender();\nvar buffer = docx\n\t.getZip()\n\t.generate({type:\"nodebuffer\"});\nfs.writeFile(\"test.docx\", buffer);\n```\n\n## Usage: Text and URL in powerpoint pptx\n\nThe example below will displays the following hyperlink powerpoint:\n\u003e Lorem ipsum [dolor sit](http://google.com) amet.\n\nYour pptx should contain the text: `Lorem ipsum {^link} amet.`.\n\n```js\nvar fs = require('fs');\nvar content = fs.readFileSync(__dirname + \"/example-href.pptx\", \"binary\");\nvar DocxGen = require('docxtemplater');\nvar LinkModule = require('docxtemplater-link-module');\nvar linkModule = new LinkModule();\n \nvar docx = new DocxGen()\n\t.attachModule(linkModule)\n\t.setOptions({ fileType : \"pptx\" })\n\t.load(content)\n\t.setData({\n\t\tlink : {\n\t\t\ttext : \"dolor sit\",\n\t\t\turl : \"http://google.com\"\n\t\t}\n\t}).\n\trender();\nvar buffer = docx\n\t.getZip()\n\t.generate({type:\"nodebuffer\"});\nfs.writeFile(\"output-href.pptx\", buffer);\n```\n\n## Usage: Email address support in powerpoint\n\nThe example below will displays the following hyperlink:\n\u003e Lorem ipsum [john.smith@example.com](mailto:john.smith@example.com) amet.\n\nYour pptx should contain the text: `Lorem ipsum {^link} amet.`.\n\n```js\nvar fs = require('fs');\nvar content = fs.readFileSync(__dirname + \"/example-mailto.pptx\", \"binary\");\nvar DocxGen = require('docxtemplater');\nvar LinkModule = require('docxtemplater-link-module');\nvar linkModule = new LinkModule();\n \nvar docx = new DocxGen()\n\t.attachModule(linkModule)\n\t.setOptions({ fileType : \"pptx\" })\n\t.load(content)\n\t.setData({\n\t\tlink : \"john.smith@example.com\"\n\t}).\n\trender();\nvar buffer = docx\n\t.getZip()\n\t.generate({type:\"nodebuffer\"});\nfs.writeFile(\"output-mailto.pptx\", buffer);\n```\n\n\n## Testing \n\nYou 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\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujith3g%2Fdocxtemplater-link-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsujith3g%2Fdocxtemplater-link-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujith3g%2Fdocxtemplater-link-module/lists"}