
python-docx — python-docx 1.2.0 documentation
python-docx ¶ Release v1.2.0 (Installation) python-docx is a Python library for creating and updating Microsoft Word (.docx) files.
Quickstart — python-docx 1.2.0 documentation - Read the Docs
This opens up a blank document based on the default “template”, pretty much what you get when you start a new document in Word using the built-in defaults. You can open and work on an existing …
Working with Documents — python-docx 1.2.0 documentation
python-docx allows you to create new documents as well as make changes to existing ones. Actually, it only lets you make changes to existing documents; it’s just that if you start with a document that …
Document objects — python-docx 1.2.0 documentation
Return a Document object loaded from docx, where docx can be either a path to a .docx file (a string) or a file-like object. If docx is missing or None, the built-in default document “template” is loaded.
Installing — python-docx 1.2.0 documentation
python-docx depends on the lxml package. Both pip and easy_install will take care of satisfying those dependencies for you, but if you use this last method you will need to install those yourself.
Working with Text — python-docx 1.2.0 documentation
>>> from docx.shared import RGBColor >>> font.color.rgb = RGBColor(0x42, 0x24, 0xE9)
Working with Comments — python-docx 1.2.0 documentation
In general the python-docx API will not allow these operations but if you outsmart it then the resulting comment will either be silently removed or trigger a repair error when the document is loaded by Word.
Working with Styles — python-docx 1.2.0 documentation
A style name can also be assigned directly, in which case python-docx will do the lookup for you:
Font Color — python-docx 1.2.0 documentation - Read the Docs
docx.dml.color.ColorFormat has a read-only type property and read/write rgb, theme_color, and brightness properties. ColorFormat.type returns one of MSO_COLOR_TYPE.RGB, …
Table objects — python-docx 1.2.0 documentation
_Rows objects ¶ class docx.table._Rows(tbl: CT_Tbl, parent: TableParent) [source] ¶ Sequence of _Row objects corresponding to the rows in a table. Supports len(), iteration, indexed access, and …