艺赛旗(PRA)根据制式模板批量生成 word 文件
艺赛旗 RPA8.0全新首发免费下载 点击下载
http://www.i-search.com.cn/index.html?from=line1
请看程序运行过程:
操作 word 其实是一件很痛苦的事情,做不到语义分析其实意义就不大。但是有一点我们是可以尝试一下的,那就是根据制式的 word 模板批量生成文件,可以应用在政府机关某些文件下发里,再配合邮件发送功能,价值感这是不要太好了。今天就给大家分享一下生成 word 文件的代码。
代码:
#-- coding:utf-8 --
from docxtpl import DocxTemplate
tpl = DocxTemplate(r’C:\Users\Administrator\Desktop\Totem01.docx’)
#写word文档
context = {
‘name’: ‘张稼森’,
‘age’:‘男’,
‘phone’:‘17733829102’,
‘mail’:‘[email protected]’,
‘id’:‘1234567890’,
‘addre’:‘五道口职业技术学院’
}
tpl.render(context)
tpl.save(“C:{}的简历.docx”.format(‘Totem’))
运行结果:
附件里有我截图的模板供大家参考
[70881dac8f1c43f0ac642bf1310e125f_Totem01.docx
](http://)