From 6ad18420e55c3fea1e94efeebeb473c739397d4d Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 5 Mar 2023 18:46:02 +0000 Subject: [PATCH] Add hyperlink to demo --- demo/85-template-document.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/demo/85-template-document.ts b/demo/85-template-document.ts index 921a9befbb..64d4f0a58b 100644 --- a/demo/85-template-document.ts +++ b/demo/85-template-document.ts @@ -2,6 +2,7 @@ // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; import { + ExternalHyperlink, HeadingLevel, ImageRun, Paragraph, @@ -39,7 +40,19 @@ patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), { }, footer_text: { type: PatchType.PARAGRAPH, - children: [new TextRun("replaced just as well")], + children: [ + new TextRun("replaced just as"), + new TextRun(" well"), + new ExternalHyperlink({ + children: [ + new TextRun({ + text: "BBC News Link", + style: "Hyperlink", + }), + ], + link: "https://www.bbc.co.uk/news", + }), + ], }, image_test: { type: PatchType.PARAGRAPH,