Update demo 35 with new API
This commit is contained in:
@ -11,10 +11,12 @@ const doc = new Document({
|
|||||||
children: [
|
children: [
|
||||||
new TextRun("Click here for the "),
|
new TextRun("Click here for the "),
|
||||||
new ExternalHyperlink({
|
new ExternalHyperlink({
|
||||||
child: new TextRun({
|
children: [
|
||||||
|
new TextRun({
|
||||||
text: "Footnotes external hyperlink",
|
text: "Footnotes external hyperlink",
|
||||||
style: "Hyperlink",
|
style: "Hyperlink",
|
||||||
}),
|
}),
|
||||||
|
],
|
||||||
link: "http://www.example.com",
|
link: "http://www.example.com",
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -31,10 +33,12 @@ const doc = new Document({
|
|||||||
children: [
|
children: [
|
||||||
new TextRun("Click here for the "),
|
new TextRun("Click here for the "),
|
||||||
new ExternalHyperlink({
|
new ExternalHyperlink({
|
||||||
child: new TextRun({
|
children: [
|
||||||
|
new TextRun({
|
||||||
text: "Footer external hyperlink",
|
text: "Footer external hyperlink",
|
||||||
style: "Hyperlink",
|
style: "Hyperlink",
|
||||||
}),
|
}),
|
||||||
|
],
|
||||||
link: "http://www.example.com",
|
link: "http://www.example.com",
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -49,10 +53,12 @@ const doc = new Document({
|
|||||||
children: [
|
children: [
|
||||||
new TextRun("Click here for the "),
|
new TextRun("Click here for the "),
|
||||||
new ExternalHyperlink({
|
new ExternalHyperlink({
|
||||||
child: new TextRun({
|
children: [
|
||||||
|
new TextRun({
|
||||||
text: "Header external hyperlink",
|
text: "Header external hyperlink",
|
||||||
style: "Hyperlink",
|
style: "Hyperlink",
|
||||||
}),
|
}),
|
||||||
|
],
|
||||||
link: "http://www.google.com",
|
link: "http://www.google.com",
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -64,10 +70,12 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ExternalHyperlink({
|
new ExternalHyperlink({
|
||||||
child: new TextRun({
|
children: [
|
||||||
|
new TextRun({
|
||||||
text: "Anchor Text",
|
text: "Anchor Text",
|
||||||
style: "Hyperlink",
|
style: "Hyperlink",
|
||||||
}),
|
}),
|
||||||
|
],
|
||||||
link: "http://www.example.com",
|
link: "http://www.example.com",
|
||||||
}),
|
}),
|
||||||
new FootnoteReferenceRun(1),
|
new FootnoteReferenceRun(1),
|
||||||
@ -76,24 +84,63 @@ const doc = new Document({
|
|||||||
new Paragraph({
|
new Paragraph({
|
||||||
children: [
|
children: [
|
||||||
new ExternalHyperlink({
|
new ExternalHyperlink({
|
||||||
child: new ImageRun({
|
children: [
|
||||||
|
new ImageRun({
|
||||||
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
data: fs.readFileSync("./demo/images/image1.jpeg"),
|
||||||
transformation: {
|
transformation: {
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
],
|
||||||
link: "http://www.google.com",
|
link: "http://www.google.com",
|
||||||
}),
|
}),
|
||||||
new ExternalHyperlink({
|
new ExternalHyperlink({
|
||||||
child: new TextRun({
|
children: [
|
||||||
|
new TextRun({
|
||||||
text: "BBC News Link",
|
text: "BBC News Link",
|
||||||
style: "Hyperlink",
|
style: "Hyperlink",
|
||||||
}),
|
}),
|
||||||
|
],
|
||||||
link: "https://www.bbc.co.uk/news",
|
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",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user