如何使用officegen nodejs将自定义图像/样式文本添加到表格单元格

我正在使用officegen使用nodejs创buildMS-word文件。 到目前为止,它工作得很好。 我需要将自定义图像添加到表单元格。 但我想出任何办法。 现在我只是使用他们的默认示例表。

码:

var officegen = require('officegen'); var docx = officegen ( 'docx' ); var table = [ [{ val: "No.", opts: { cellColWidth: 4261, b:true, sz: '48', shd: { fill: "7F7F7F", themeFill: "text1", "themeFillTint": "80" }, fontFamily: "Avenir Book" } },{ val: "Title1", opts: { b:true, color: "A00000", align: "right", shd: { fill: "92CDDC", themeFill: "text1", "themeFillTint": "80" } } },{ val: "Title2", opts: { align: "center", vAlign: "center", cellColWidth: 42, b:true, sz: '48', shd: { fill: "92CDDC", themeFill: "text1", "themeFillTint": "80" } } }], [1,'All grown-ups were once children','I need to add custom image here'], [2,'there is no harm in putting off a piece of work until another day.',''], [3,'But when it is a matter of baobabs, that always means a catastrophe.',''], [4,'watch out for the baobabs!','END'], ] var tableStyle = { tableColWidth: 4261, tableSize: 24, tableColor: "ada", tableAlign: "left", tableFontFamily: "Comic Sans MS", borders: true } docx.createTable (table, tableStyle); 

上面的代码能够创build一个自定义表。 但我无法在表格单元格中添加自定义图片或段落。

我喜欢任何forms的帮助。 提前致谢

化妆第一行中的第一个单元而不是

 [1,'All grown-ups were once children','I need to add custom image here'] 

使用

 [{"val":1,"opts":{place here your desired options - same notation as heading opts}},'All grown-ups were once children','I need to add custom image here']