Add new Image class
This commit is contained in:
15
demo/demo24.js
Normal file
15
demo/demo24.js
Normal file
@ -0,0 +1,15 @@
|
||||
// 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'));
|
||||
|
||||
const imageData = docx.Media.addImage(doc, "./demo/images/image1.jpeg");
|
||||
table.getCell(1, 1).addContent(new docx.Image(imageData));
|
||||
|
||||
var exporter = new docx.LocalPacker(doc);
|
||||
exporter.pack('My Document');
|
||||
|
||||
console.log('Document created successfully at project root!');
|
Reference in New Issue
Block a user