python-docx is a Python library for reading, creating, and updating Microsoft Word 2007+ (.docx) files.
This repository exists as a fork of the official repo as I needed features and quality of life improvements.
Key differences at a glance:
- Supporting multiple numbered lists within a document (1, 2)
- Supporting TOC updates within the package without the need to open the document manually (1, 2)
- Supporting floating images within documents (1)
- Supporting the ability to transform word documents into PDF's (1)
- Horizontal rules + paragraph bounding boxes / borders (1, 2)
- External hyperlinks (1)
- Internal hyperlinks (Linking to bookmarks) (1)
- Creating bookmarks (1)
- The ability to insert a customisable Table of Contents (ToC) (1)
pip install skelmis-docx
>>> from skelmis.docx import Document
>>> document = Document()
>>> document.add_paragraph("It was a dark and stormy night.")
<docx.text.paragraph.Paragraph object at 0x10f19e760>
>>> 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 documentation