.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.2.0.tar.gz
(16.4 kB
view details)
Built Distribution
cmi_docx-0.2.0-py3-none-any.whl
(17.8 kB
view details)
File details
Details for the file cmi_docx-0.2.0.tar.gz
.
File metadata
- Download URL: cmi_docx-0.2.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5308361834186b4283161429a0627c8b52876ef0668a24361859138efb9493e1 |
|
MD5 | 8288be37ca0dee4c051e0827e6d0eab6 |
|
BLAKE2b-256 | 2aa1a38002ea3fff928fbcec78320423dee437b6eeb5ca2ce6dea847aef64c03 |
Provenance
File details
Details for the file cmi_docx-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: cmi_docx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78a70b0d77a403b29624868fb1ec0c25097100a02f8039184efeb8a12231d0e1 |
|
MD5 | 9afa3d817b83f6c39ee2ab66423ede8d |
|
BLAKE2b-256 | a7a3199f048d00943abe51bb7a830bb9a34ca8be38ceebe374c8bf82f2b1f7be |