diff --git a/demo/demo16.js b/demo/demo16.js index b5db3d03b6..ce0b162dc1 100644 --- a/demo/demo16.js +++ b/demo/demo16.js @@ -1,14 +1,10 @@ -const docx = require('../build'); +const docx = require("../build"); var doc = new docx.Document(); -var paragraph = new docx.Paragraph("Hello World"); -var paragraph2 = new docx.Paragraph("Hello World on another page").pageBreak(); +var paragraph = new docx.Paragraph("Hello World").pageBreak(); doc.addParagraph(paragraph); -doc.addParagraph(paragraph2); - -doc.createParagraph("hello").pageBreak(); var header = doc.createHeader(); header.createParagraph("Header on another page"); @@ -16,13 +12,25 @@ var footer = doc.createFooter(); footer.createParagraph("Footer on another page"); doc.addSection({ - headerId: header.Header.referenceId, - footerId: footer.Footer.referenceId, - pageNumberStart: 1, - pageNumberFormatType: docx.PageNumberFormat.DECIMAL, + headerId: header.Header.referenceId, + footerId: footer.Footer.referenceId, + pageNumberStart: 1, + pageNumberFormatType: docx.PageNumberFormat.DECIMAL, }); -var exporter = new docx.LocalPacker(doc); -exporter.pack('My Document'); +doc.createParagraph("hello"); -console.log('Document created successfully at project root!'); +doc.addSection({ + headerId: header.Header.referenceId, + footerId: footer.Footer.referenceId, + pageNumberStart: 1, + pageNumberFormatType: docx.PageNumberFormat.DECIMAL, + orientation: docx.PageOrientation.LANDSCAPE, +}); + +doc.createParagraph("hello in landscape"); + +var exporter = new docx.LocalPacker(doc); +exporter.pack("My Document"); + +console.log("Document created successfully at project root!");