Update demo 35 with new API

This commit is contained in:
Rowan Cockett
2021-08-31 18:55:38 -06:00
parent c1cc211c7f
commit 243d73542f

View File

@ -11,10 +11,12 @@ const doc = new Document({
children: [
new TextRun("Click here for the "),
new ExternalHyperlink({
child: new TextRun({
text: "Footnotes external hyperlink",
style: "Hyperlink",
}),
children: [
new TextRun({
text: "Footnotes external hyperlink",
style: "Hyperlink",
}),
],
link: "http://www.example.com",
}),
],
@ -31,10 +33,12 @@ const doc = new Document({
children: [
new TextRun("Click here for the "),
new ExternalHyperlink({
child: new TextRun({
text: "Footer external hyperlink",
style: "Hyperlink",
}),
children: [
new TextRun({
text: "Footer external hyperlink",
style: "Hyperlink",
}),
],
link: "http://www.example.com",
}),
],
@ -49,10 +53,12 @@ const doc = new Document({
children: [
new TextRun("Click here for the "),
new ExternalHyperlink({
child: new TextRun({
text: "Header external hyperlink",
style: "Hyperlink",
}),
children: [
new TextRun({
text: "Header external hyperlink",
style: "Hyperlink",
}),
],
link: "http://www.google.com",
}),
],
@ -64,10 +70,12 @@ const doc = new Document({
new Paragraph({
children: [
new ExternalHyperlink({
child: new TextRun({
text: "Anchor Text",
style: "Hyperlink",
}),
children: [
new TextRun({
text: "Anchor Text",
style: "Hyperlink",
}),
],
link: "http://www.example.com",
}),
new FootnoteReferenceRun(1),
@ -76,24 +84,63 @@ const doc = new Document({
new Paragraph({
children: [
new ExternalHyperlink({
child: new ImageRun({
data: fs.readFileSync("./demo/images/image1.jpeg"),
transformation: {
width: 100,
height: 100,
},
}),
children: [
new ImageRun({
data: fs.readFileSync("./demo/images/image1.jpeg"),
transformation: {
width: 100,
height: 100,
},
}),
],
link: "http://www.google.com",
}),
new ExternalHyperlink({
child: new TextRun({
text: "BBC News Link",
style: "Hyperlink",
}),
children: [
new TextRun({
text: "BBC News Link",
style: "Hyperlink",
}),
],
link: "https://www.bbc.co.uk/news",
}),
],
}),
new Paragraph({
children: [
new TextRun({
text: "This is a hyperlink with formatting: ",
}),
new ExternalHyperlink({
children: [
new TextRun({
text: "A ",
style: "Hyperlink",
}),
new TextRun({
text: "single ",
bold: true,
style: "Hyperlink",
}),
new TextRun({
text: "link",
doubleStrike: true,
style: "Hyperlink",
}),
new TextRun({
text: "1",
superScript: true,
style: "Hyperlink",
}),
new TextRun({
text: "!",
style: "Hyperlink",
}),
],
link: "http://www.example.com",
}),
],
}),
],
},
],