2017-03-12 21:34:49 +00:00
|
|
|
const docx = require('../build');
|
|
|
|
|
2017-12-19 21:49:44 +00:00
|
|
|
var doc = new docx.File();
|
2017-03-12 21:34:49 +00:00
|
|
|
|
|
|
|
var paragraph = new docx.Paragraph("Hello World");
|
|
|
|
var institutionText = new docx.TextRun("University College London").bold();
|
|
|
|
var dateText = new docx.TextRun("5th Dec 2015").tab().bold();
|
2017-03-26 20:57:43 +01:00
|
|
|
paragraph.addRun(institutionText);
|
|
|
|
paragraph.addRun(dateText);
|
2017-03-12 21:34:49 +00:00
|
|
|
|
|
|
|
doc.addParagraph(paragraph);
|
2017-03-26 20:57:43 +01:00
|
|
|
|
2017-04-01 12:21:59 +01:00
|
|
|
var exporter = new docx.LocalPacker(doc);
|
2017-03-12 21:34:49 +00:00
|
|
|
exporter.pack('My Document');
|
|
|
|
|
2018-01-22 21:34:09 +00:00
|
|
|
console.log('Document created succesfully at project root!');
|