2018-08-02 21:07:37 +01:00
|
|
|
// Add image to table cell
|
|
|
|
const docx = require('../build');
|
|
|
|
|
|
|
|
var doc = new docx.Document();
|
|
|
|
|
|
|
|
const table = doc.createTable(4, 4);
|
|
|
|
table.getCell(2, 2).addContent(new docx.Paragraph('Hello'));
|
|
|
|
|
2018-08-03 00:01:42 +01:00
|
|
|
const image = docx.Media.addImage(doc, "./demo/images/image1.jpeg");
|
|
|
|
table.getCell(1, 1).addContent(image);
|
2018-08-02 21:07:37 +01:00
|
|
|
|
|
|
|
var exporter = new docx.LocalPacker(doc);
|
|
|
|
exporter.pack('My Document');
|
|
|
|
|
|
|
|
console.log('Document created successfully at project root!');
|