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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db298019cf7a0d8ce14a0868b27a64dbc103f0babe82d94ebfbe615fe44e2f91
|
|
| MD5 |
1cb7c63f757d10dc5beff07377e6b6e4
|
|
| BLAKE2b-256 |
eb24b5c54d96634d31dca4a01c49aa6af1962483f88de61e2b167cc564e0b5ec
|
File details
Details for the file docxtexthighlighter-1.0.0-py3-none-any.whl.
File metadata
- Download URL: docxtexthighlighter-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2350a1c296b2bdae5e25f1ec7bf1c619ae1625b31f6e4133175ba927e059ad4a
|
|
| MD5 |
8d0fa6f68ff2a8fc2024d376037c2cb7
|
|
| BLAKE2b-256 |
6061637dfd22785644f561b05b82ab18140a6fff0f61cb740b49b70ea18357ae
|