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.4.2.tar.gz (32.2 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.4.2-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cmi_docx-0.4.2.tar.gz
Algorithm Hash digest
SHA256 acb638e3602ce3c0774880fbb7407cc047c20dbc4d1b4f71b48fdfac83c6f962
MD5 430c1cefab38b726511c765886539577
BLAKE2b-256 9a8a36d4bb656d00e6726fd85cefaab8a5dc7238947eb8ebb4de7ed52010261c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmi_docx-0.4.2.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.4.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for cmi_docx-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 95026a3d5d58333f0afde64ec3157673667428a990f5fe4d1fb0ea346ecc6b59
MD5 f25987c37d69019a899eb3b4fe3cf014
BLAKE2b-256 486b0baca57402fc1d65a7ef24fd552225f636cd5e92ba2172ce583821ff9e47

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmi_docx-0.4.2-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