Python-Docx: What It Can Do
Python-Docx: What It Can Do
io/en/latest/
python-docx
Release v0.8.10 (Installation)
python-docx is a Python library for creating and updating Microsoft Word (.docx) files.
What it can do
Here’s an example of what python-docx can do:
document = Document()
document.add_heading('Document Title', 0)
document.add_paragraph(
'first item in unordered list', style='List Bullet'
)
document.add_paragraph(
'first item in ordered list', style='List Number'
)
document.add_picture('monty-truth.png', width=Inches(1.25))
records = (
(3, '101', 'Spam'),
(7, '422', 'Eggs'),
(4, '631', 'Spam, spam, eggs, and spam')
)
1 of 4 24/9/20, 10:33 pm
python-docx — python-docx 0.8.10 documentation https://python-docx.readthedocs.io/en/latest/
document.add_page_break()
document.save('demo.docx')
User Guide
Installing
Quickstart
Working with Documents
Working with Text
Working with Sections
Working with Headers and Footers
API basics
Understanding Styles
Working with Styles
Understanding pictures and other shapes
API Documentation
Document objects
Document constructor
Document objects
CoreProperties objects
Document Settings objects
Style-related objects
Styles objects
BaseStyle objects
_CharacterStyle objects
_ParagraphStyle objects
_TableStyle objects
_NumberingStyle objects
LatentStyles objects
_LatentStyle objects
Text-related objects
Paragraph objects
ParagraphFormat objects
Run objects
v: latest
Font objects
TabStop objects
2 of 4 24/9/20, 10:33 pm
python-docx — python-docx 0.8.10 documentation https://python-docx.readthedocs.io/en/latest/
TabStops objects
Table objects
Table objects
_Cell objects
_Row objects
_Column objects
_Rows objects
_Columns objects
Section objects
Sections objects
Section objects
_Header and _Footer objects
Shape-related objects
InlineShapes objects
InlineShape objects
DrawingML objects
ColorFormat objects
Shared classes
Length objects
RGBColor objects
Enumerations
MSO_COLOR_TYPE
MSO_THEME_COLOR_INDEX
WD_PARAGRAPH_ALIGNMENT
WD_BUILTIN_STYLE
WD_CELL_VERTICAL_ALIGNMENT
WD_COLOR_INDEX
WD_LINE_SPACING
WD_ORIENTATION
WD_TABLE_ALIGNMENT
WD_ROW_HEIGHT_RULE
WD_SECTION_START
WD_STYLE_TYPE
WD_TAB_ALIGNMENT
WD_TAB_LEADER
WD_TABLE_DIRECTION
WD_UNDERLINE
v: latest
Contributor Guide
3 of 4 24/9/20, 10:33 pm
python-docx — python-docx 0.8.10 documentation https://python-docx.readthedocs.io/en/latest/
Analysis
v: latest
4 of 4 24/9/20, 10:33 pm