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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cmi_docx-0.3.0.tar.gz
Algorithm Hash digest
SHA256 52cc2acd65e26174ff4d13dd55695a7d004d85bd7e0f3590c748189a7a96317d
MD5 02062f4b3ff52e1382df8aae4f8592f3
BLAKE2b-256 1be543ca0fa3922096fa1205eb262778e74abd26167748c00102d74b4dafada5

See more details on using hashes here.

Provenance

File details

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

File metadata

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

File hashes

Hashes for cmi_docx-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50e44580d74ffe1a7d7190346403ff92ecfda3b5c7461032bd540b273c9feb0a
MD5 63ba1dba144e1a4eb0a0bedf5461f3a2
BLAKE2b-256 c44590fed121e14f6230efdb3e53b59fc0443679e3f91baf2cff2b038cb37445

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