首页 软件分享docxtpl-cli 根据模板导出word的node命令行工具

docxtpl-cli 根据模板导出word的node命令行工具

发布于: 2018-08-20 11:27:00
字数: 775
评论: 1
阅读: 4066

工具介绍

该工具是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文档


扫描二维码,在手机上阅读
评论列表:
天津网站建设
2018-09-02 14:25
感谢博主分享