Allow patching of ExternalHyperlinks

This commit is contained in:
Dolan Miu
2023-03-08 23:30:51 +00:00
parent 6ad18420e5
commit 0fba450c9a
3 changed files with 125 additions and 24 deletions

View File

@ -28,7 +28,17 @@ patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
},
item_1: {
type: PatchType.PARAGRAPH,
children: [new TextRun("#657")],
children: [
new TextRun("#657"),
new ExternalHyperlink({
children: [
new TextRun({
text: "BBC News Link",
}),
],
link: "https://www.bbc.co.uk/news",
}),
],
},
paragraph_replace: {
type: PatchType.DOCUMENT,
@ -47,7 +57,6 @@ patchDocument(fs.readFileSync("demo/assets/simple-template.docx"), {
children: [
new TextRun({
text: "BBC News Link",
style: "Hyperlink",
}),
],
link: "https://www.bbc.co.uk/news",