Skip to main content

A package that helps to highlight words in your docx file, and generate a new docx file with the highlighted words.

Project description

Bold Words in Text Function

This Python function allows you to bold specific words or phrases in a .docx document. It is designed to work with the python-docx library and supports flexible, case-insensitive matching to bold target phrases while respecting word boundaries.

Features

  • Case-insensitive matching: The function matches words regardless of casing.
  • Word boundaries: Ensures only full words are matched, avoiding partial matches inside larger words.
  • Support for multiple phrases: You can pass a list of phrases to be bolded in the document.

How to install

Run the following commands:

$ pip install docxtexthighlighter

Example

>>> from docxtexthighlighter import bold_words_in_text

>>> list_of_words_to_be_bolded = ['dogs', 'cats', 'birds']

>>> bold_words_in_text('path/to/your/docx/file', list_of_words_to_be_bolded, output_path='path/to/your/output/location')

"Document has been saved to this path: 'path/to/your/output/location'"

Notes

By default, the function saves the output to your current working directory as 'output.docx'.

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

docxtexthighlighter-1.0.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

docxtexthighlighter-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file docxtexthighlighter-1.0.0.tar.gz.

File metadata

  • Download URL: docxtexthighlighter-1.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.10

File hashes

Hashes for docxtexthighlighter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 db298019cf7a0d8ce14a0868b27a64dbc103f0babe82d94ebfbe615fe44e2f91
MD5 1cb7c63f757d10dc5beff07377e6b6e4
BLAKE2b-256 eb24b5c54d96634d31dca4a01c49aa6af1962483f88de61e2b167cc564e0b5ec

See more details on using hashes here.

File details

Details for the file docxtexthighlighter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for docxtexthighlighter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2350a1c296b2bdae5e25f1ec7bf1c619ae1625b31f6e4133175ba927e059ad4a
MD5 8d0fa6f68ff2a8fc2024d376037c2cb7
BLAKE2b-256 6061637dfd22785644f561b05b82ab18140a6fff0f61cb740b49b70ea18357ae

See more details on using hashes here.

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