安装python-dock
From docx import Document
打开、新建word文档
新建文档:document=Document()
Document.save(‘filename.docx’)
添加文本:text=document.add_paragraph(‘content of the paragraph’)
更改项目符号:text.style=’stylename’
添加标题:document.add_heading(‘head-name’)
添加图片:document.add_picture(‘path of the picture’)
字体设置:
设置加粗:text.run.font.bold=True
设置字号:text.run.font.size=pt(sizeNumber)
设置字体颜色:text.run.font.color=