.docx utilities
Project description
CMI-docx
cmi-docx
is a Python library for manipulating .docx files built on top of python-docx
. It extends the functionality of python-docx
by providing additional features and utilities for working with .docx files.
Features
- Find and replace.
- Insert paragraphs in the middle of a document.
- Manipulate styles and formatting of paragraphs' substrings.
Installation
Install this package from pypi using your favorite package manager. For example, using pip
:
pip install cmi-docx
Quick start
The following example demonstratesa few features of cmi-docx:
import docx
from cmi_docx import document
doc = docx.Document()
paragraph = doc.add_paragraph("Hello, world!")
extend_document = document.ExtendDocument(doc)
extend_paragraph = document.ExtendParagraph(paragraph)
# Find and replace text.
extend_document.replace("Hello", "Hi", {"bold": True})
# Insert and image
extend_document.insert_image(index=1, image_path="path/to/image.png")
# Reformat a paragraph
extend_paragraph.format(italics=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cmi_docx-0.3.2.tar.gz
(16.2 kB
view details)
Built Distribution
cmi_docx-0.3.2-py3-none-any.whl
(17.4 kB
view details)
File details
Details for the file cmi_docx-0.3.2.tar.gz
.
File metadata
- Download URL: cmi_docx-0.3.2.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bc80797c534a6c905872aa98360790bc8c5d9457659cf15a7883ae55726c838 |
|
MD5 | 1d26a65bfa32523d0c928e2c93345728 |
|
BLAKE2b-256 | 5b2a2c02f2027930ae2c51bcc35de1c7390bff2c0c58efc0e3bcf850874ba7f5 |
Provenance
File details
Details for the file cmi_docx-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: cmi_docx-0.3.2-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05d5a8e317a3df1b39b7732f35590531ad2ffc96ec9fac7f5546f02c16c134a2 |
|
MD5 | 0e17b42c8fb6822c9a5dd6880ef58a82 |
|
BLAKE2b-256 | 8c8d9a87d51db9ecf80b3bd52f3cd41d23de1e334ed2946f6a040b0a3c6ff468 |