Skip to main content

.docx utilities

Project description

CMI-docx

Build codecov Ruff stability-stable LGPL--2.1 License pages

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


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 details)

Uploaded Source

Built Distribution

cmi_docx-0.1.6-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file cmi_docx-0.1.6.tar.gz.

File metadata

  • Download URL: cmi_docx-0.1.6.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for cmi_docx-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ba46207ddec8d4b4ce1637275b2b1ac5f4e6719d0a1219e5f869af9e7a877db2
MD5 9c8f706b512d466abc28c483983d8ff3
BLAKE2b-256 373a7dd28f2dda1599f2796907908a9a1bffce36303325b74d4a53ef0218c635

See more details on using hashes here.

Provenance

File details

Details for the file cmi_docx-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: cmi_docx-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for cmi_docx-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 05815262e431874017d37de617dfbb020a4c62d17137af11a57cff3971b19a4a
MD5 97bcb2b0059bf9a7cfcaa47dd4687e7e
BLAKE2b-256 0de8d1d3b4423f335d07bd293854a5af40ac1791b1029499931c6455e411ed2d

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page