python-openxml /python-docx
Create and modify Word documents with Python
★ 5,770⑂ 1,337👁 137⑃ 304● 1,330▤ 0
+2
日增长
5,770
stars
1,337
forks
137
watchers
304
prs
1,330
issues
0
releases
README
python-docx
python-docx is a Python library for reading, creating, and updating Microsoft Word 2007+ (.docx) files.
Installation
pip install python-docx
Example
python
from docx import Document
document = Document()
document.add_paragraph("It was a dark and stormy night.")
document.save("dark-and-stormy.docx")
document = Document("dark-and-stormy.docx")
document.paragraphs[0].text
'It was a dark and stormy night.'
More information is available in the python-docx documentationTop issues
#74feature: Paragraph.add_hyperlink()52 comments · 2014-07-08#91feature: add custom properties support43 comments · 2014-08-27#30Can search and replace functions be added to python-docx?39 comments · 2014-03-26#25Restart numbering of an ordered list in document.37 comments · 2014-03-18#425Feature: Add Bookmark35 comments · 2017-08-17#97feature: add cross-reference33 comments · 2014-09-25#284extension: support .docm (macro-enabled) Word files29 comments · 2016-03-21#122how to create nested list?27 comments · 2015-01-06