转载请注明出处: 子恒博客
工具介绍
该工具是nodejs环境下的一个命令行工具,可以根据word模板和一个json数据文件来导出对应的word。命令行工具可以结合各种语言来进行批量的word导出工作。
该项目依赖了docxtemplater,下面是docxtemplater的介绍
docxtemplater is a mail merging tool that is used programmatically and handles conditions, loops, and can be extended to insert anything (tables, html, images).
docxtemplater uses JSON (Javascript objects) as data input, so it can also be used easily from other languages. It handles docx but also pptx templates.
It works in the same way as a templating engine.
docxtemplater官方自带的cli不可用(至少我这里运行不了)。所以自己写了一个,需要的可以试试。
安装
使用npm或yarn安装
# npm
npm i -g docxtpl-cli
# yarn
yarn global add docxtpl-cli
使用说明
> docxtpl // 可查看使用说明和版本号
> docxtpl input.docx data.json output.docx 将input.docx模版,根据data.json的数据,转换成output.docx
word模板制作可参考 docxtemplater文档
@子恒:😂躺平吧,世界都跟你没关系
#明天就要开学了#
😂fenxi.me这个域名真好
#友情链接#
你写得非常清晰明了,让我很容易理解你的观...
#Emlog插件RSS订阅器发布#
一直到今天,还没10天,我支付宝里仅剩7...
#让chatgpt写了一篇文章描述了我目前的穷#
@樊鑫:不支持,仅支持pro版本,可以在...
#Beginning-Pro发布,Emlog-Pro + Beginning-Pro, 更Pro#
支持5.3吗?在哪里购买/下载?
#Beginning-Pro发布,Emlog-Pro + Beginning-Pro, 更Pro#