.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.1.6.tar.gz
(16.2 kB
view hashes)
Built Distribution
cmi_docx-0.1.6-py3-none-any.whl
(17.4 kB
view hashes)