项目需求:根据网页端填写的信息,自动生成对应的doc文档

具体实现:使用docxtpl模块,返回一个属性字典,自动填充doc文档

官方文档:https://docxtpl.readthedocs.io/en/latest/

from docxtpl import DocxTemplate

doc = DocxTemplate("my_word_template.docx")
context = { 'company_name' : "World company" }
doc.render(context)
doc.save("generated_doc.docx")

 

相关文章:

  • 2021-08-21
  • 2021-05-03
  • 2021-11-17
  • 2021-12-03
  • 2021-10-07
  • 2022-02-13
  • 2022-01-01
猜你喜欢
  • 2022-02-15
  • 2021-10-28
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
相关资源
相似解决方案