docxtemplater根据json模板生成word
1.把官网的html拿过来
https://docxtemplater.readthedocs.io/en/latest/generate.html#browser
2.将模板docx文件下载到目录下
3.将html中文件路径换成本地
注意:
如果模板中需要用到某个对象的属性,例如
则需要引入angular-expressions.js,在generate()方法中需要添加
angularParser= function(tag){
expr=expressions.compile(tag);
return {get:expr};
}
在loadFile方法回调中需要添加
doc.setOptions({parser:angularParser})