Make .addSection fully declarative
This commit is contained in:
@ -14,26 +14,28 @@
|
||||
function generate() {
|
||||
const doc = new docx.Document();
|
||||
|
||||
doc.addSection({
|
||||
children: [
|
||||
new docx.Paragraph({
|
||||
const doc = new Document({
|
||||
sections: [
|
||||
{
|
||||
children: [
|
||||
new docx.TextRun("Hello World"),
|
||||
new docx.TextRun({
|
||||
text: "Foo Bar",
|
||||
bold: true,
|
||||
}),
|
||||
new docx.TextRun({
|
||||
text: "\tGithub is the best",
|
||||
bold: true,
|
||||
new docx.Paragraph({
|
||||
children: [
|
||||
new docx.TextRun("Hello World"),
|
||||
new docx.TextRun({
|
||||
text: "Foo Bar",
|
||||
bold: true,
|
||||
}),
|
||||
new docx.TextRun({
|
||||
text: "\tGithub is the best",
|
||||
bold: true,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
|
||||
docx.Packer.toBlob(doc).then((blob) => {
|
||||
console.log(blob);
|
||||
saveAs(blob, "example.docx");
|
||||
|
Reference in New Issue
Block a user