Work on moving Document into its own wrapper
This commit is contained in:
@ -1,13 +1,31 @@
|
||||
// Example on how to add hyperlinks to websites
|
||||
// Import from 'docx' rather than '../build' if you install from npm
|
||||
import * as fs from "fs";
|
||||
import { ExternalHyperlink, Document, Packer, Paragraph, Media, TextRun } from "../build";
|
||||
import { ExternalHyperlink, Document, Packer, Paragraph, Media, TextRun, Footer } from "../build";
|
||||
|
||||
const doc = new Document({});
|
||||
|
||||
const image1 = Media.addImage(doc, fs.readFileSync("./demo/images/image1.jpeg"));
|
||||
|
||||
doc.addSection({
|
||||
footers: {
|
||||
default: new Footer({
|
||||
children: [
|
||||
new Paragraph({
|
||||
children: [
|
||||
new TextRun("Click here for the "),
|
||||
new ExternalHyperlink({
|
||||
child: new TextRun({
|
||||
text: "Footer external hyperlink",
|
||||
style: "Hyperlink",
|
||||
}),
|
||||
link: "http://www.example.com",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
},
|
||||
children: [
|
||||
new Paragraph({
|
||||
children: [
|
||||
|
Reference in New Issue
Block a user