辰东,盗墓笔记第二季,完美世界有声小说
http://marshallsonline.cn/tag/officegen/
-
nodejs 生成 word officegen模塊使用方法
http://marshallsonline.cn/inews/n3/officegen.html
2021-11-16T09:34:00+08:00
詳細文檔鏈接https://github.com/Ziv-Barber/officegen/blob/87dd5501968501555ea3bee60043affc9f67c1fa/manual/docx/README.md引用const officegen = require('officegen');監(jiān)聽docx.on('finalize', function(written) {
console.log(
'Finish to create a Microsoft Word document.'
);
});
// Officegen calling this function to report errors:
docx.on('error', function(err) {
console.log(err);
});
out.on('error', function(err) {
console.log(err);
});生成一行l(wèi)et pObj = docx.createP();行內(nèi)添加文字元素pObj.addText(' and back color.', { color: '00ffff', back: '000088',shdType: 'pct12',shdColor: 'ff0000' ,link: 'https://github.com'});設(shè)置文字對齊方式pObj.options.align = 'right';關(guān)聯(lián)文件并導(dǎo)出const out = fs.createWriteStream('./app/public/example.docx');
docx.generate(out);