.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.3.tar.gz
(16.3 kB
view details)
Built Distribution
cmi_docx-0.3.3-py3-none-any.whl
(17.5 kB
view details)
File details
Details for the file cmi_docx-0.3.3.tar.gz
.
File metadata
- Download URL: cmi_docx-0.3.3.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceadd4423b74f4fbb7ed786f01582700b46786d454fd99425b39a71da9fe875a |
|
MD5 | 9579c3fc3387095cde4fa19454d12dd6 |
|
BLAKE2b-256 | 24819142274cd5c7f5af2e88e5b9f762168dc3df297364eb1ad62c7cfb398834 |
Provenance
File details
Details for the file cmi_docx-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: cmi_docx-0.3.3-py3-none-any.whl
- Upload date:
- Size: 17.5 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 | b116a7ffbc9c7246b5ac16debd971a905b3615764e2fa2a3e1b7b0218ed49bb5 |
|
MD5 | 93e52098571c591657fca478aedc5787 |
|
BLAKE2b-256 | 42eaad038661ff6dbbef17caa45edde71f21fef2f48c4da1b9b579dc3526a8d9 |