Edit docx with python
Project description
docx-editor
Pure Python library for Word document track changes and comments, without requiring Microsoft Word.
Note: The PyPI package is named
docx-editorbecausedocx-editwas too similar to an existing package.
- Github repository: https://github.com/pablospe/docx-editor/
- Documentation: https://pablospe.github.io/docx-editor/
Features
- Track Changes: Replace, delete, and insert text with revision tracking
- Comments: Add, reply, resolve, and delete comments
- Revision Management: List, accept, and reject tracked changes
- Cross-Platform: Works on Linux, macOS, and Windows
- No Dependencies: Only requires
defusedxmlfor secure XML parsing
Installation
pip install docx-editor
Quick Start
from docx_editor import Document
with Document.open("contract.docx") as doc:
# Track changes
doc.replace("30 days", "60 days")
doc.insert_after("Section 5", "New clause")
doc.delete("obsolete text")
# Comments
doc.add_comment("Section 5", "Please review")
# Revision management
revisions = doc.list_revisions()
doc.accept_revision(revision_id=1)
doc.save()
Repository initiated with fpgmaas/cookiecutter-uv.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
docx_editor-0.0.1.tar.gz
(328.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docx_editor-0.0.1.tar.gz.
File metadata
- Download URL: docx_editor-0.0.1.tar.gz
- Upload date:
- Size: 328.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3982ec450addc2d0e630c5fc84f2fc0232d856d3ae80a5be40bef28aed0dcec1
|
|
| MD5 |
376c8c42a324fd14a27060f821655b50
|
|
| BLAKE2b-256 |
8e536f5d07dea2f7aa192cecc8e10a22af161109b4cf6a3404c2f91751f18a78
|
File details
Details for the file docx_editor-0.0.1-py3-none-any.whl.
File metadata
- Download URL: docx_editor-0.0.1-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4a422518b0cca1670a4b9dcbc097aafe4bcf6e93f84a11f0a8e2d68cb9b8d85
|
|
| MD5 |
2bf8d4839c3c53909fa4e618e300ed1f
|
|
| BLAKE2b-256 |
3fe71c80229ae2eb736c0a066fa328e179288bb163742d54b3f6c32d3573e39c
|