Skip to main content

Additional tooling for Python-docx.

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.6.1.tar.gz (45.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmi_docx-0.6.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cmi_docx-0.6.1.tar.gz
  • Upload date:
  • Size: 45.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cmi_docx-0.6.1.tar.gz
Algorithm Hash digest
SHA256 0219b8fba7f33c30ed0adda88b1d1ea29ab845e3cc24654343c99afc591caef7
MD5 912827effa83e42b108e30cbd88cfaf2
BLAKE2b-256 278caebe520eb8fbc20e2388fa913ad4c124775963dda784e6dbc17af900bac7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmi_docx-0.6.1.tar.gz:

Publisher: pypi.yaml on childmindresearch/cmi-docx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: cmi_docx-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cmi_docx-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5fc02ae14dfa529078856a32ab3f1028a70d4ce8e9a6c61eebb9de0167c0d71
MD5 3d71c41f6955ff57aabbc33509ba0d2e
BLAKE2b-256 b80288c78d98b40b974d8d85f0a90d745b4434b76169467c2152a40ae49d1fef

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmi_docx-0.6.1-py3-none-any.whl:

Publisher: pypi.yaml on childmindresearch/cmi-docx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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