2018-03-24 19:06:10 +00:00
|
|
|
const docx = require("../build");
|
2018-08-12 23:07:31 +01:00
|
|
|
const fs = require('fs');
|
2018-03-24 19:06:10 +00:00
|
|
|
|
|
|
|
var doc = new docx.Document();
|
|
|
|
|
|
|
|
var paragraph = new docx.Paragraph("Hello World");
|
|
|
|
doc.addParagraph(paragraph);
|
|
|
|
|
2018-08-12 23:07:31 +01:00
|
|
|
const image = doc.createImage(fs.readFileSync("./demo/images/pizza.gif"));
|
|
|
|
const image2 = doc.createImage(fs.readFileSync("./demo/images/pizza.gif"));
|
|
|
|
const image3 = doc.createImage(fs.readFileSync("./demo/images/pizza.gif"));
|
|
|
|
const image4 = doc.createImage(fs.readFileSync("./demo/images/pizza.gif"));
|
2018-03-24 19:06:10 +00:00
|
|
|
|
|
|
|
image.scale(0.5);
|
|
|
|
image2.scale(1)
|
2018-03-24 19:11:25 +00:00
|
|
|
image3.scale(2.5);
|
2018-03-24 19:06:10 +00:00
|
|
|
image4.scale(4);
|
|
|
|
|
|
|
|
var exporter = new docx.LocalPacker(doc);
|
|
|
|
exporter.pack("My Document");
|
|
|
|
|
|
|
|
console.log("Document created successfully at project root!");
|