WordReplaceEngine
WordReplaceEngine is a library for quickly replacing text in word. Developers only need to write the replacement logic in their program, and subsequent changes to the Word format do not require modifications to the program itself.
Language:
Usage Instructions
(1a) If you are referencing directly from GitHub, please enter the following in pip:
pip install git+https://github.com/orztrickster/WordReplaceEngine.git
(1b) If you are referencing from PyPI, please enter the following in pip:
pip install WordReplaceEngine
(2) Next, define the following at the beginning of the program:
from WordReplaceEngine import Document
(3) Create an object:
document = Document()
(4) Enter the word file to be modified. You can pre-enter the paths of all possible word files and specify the name when you need to modify them later. Here, we will arbitrarily name them word_001 to word_004. Please modify them according to your actual needs:
document.set_word_version_path("word_001", "C:/WordReplaceEngine/word_001.docx")
document.set_word_version_path("word_002", "C:/WordReplaceEngine/word_002.docx")
document.set_word_version_path("word_003", "C:/WordReplaceEngine/word_003.docx")
document.set_word_version_path("word_004", "C:/WordReplaceEngine/word_004.docx")
(5) Specify the name of the word file to be modified next, where save_path represents the storage path
document.run_version("word_001", save_path = "C:/WordReplaceEngine/")
(6a) Next, specify the corresponding string to be replaced in the word file. Here, replace $$$WordReplaceEngine_001$$$ in the word file with Hello World
document.set("$$$WordReplaceEngine_001$$$", "Hello World")
(6b) You can also specify the text size and position
from docx.shared import Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
document.set("$$$WordReplaceEngine_002$$$", "Hello WordReplaceEngine!", new_alignment = WD_PARAGRAPH_ALIGNMENT.LEFT, new_font_size = Pt(20))
(6c) You can also specify whether the text is bold, the font of Chinese or English, and the color
document.set("$$$WordReplaceEngine_003$$$", "Hello WordReplaceEngine!!!", bold = True, new_font_name = "Microsoft JhengHei", new_font_name_Chinese = "Microsoft JhengHei", font_color=(192, 0, 0))
(7) After all the information has been entered, please execute execute_set to apply the settings
document.execute_set()
(8) Next, enter output to output the file. The output file will be located in C:/WordReplaceEngine/ as specified in the example above
document.output("WordReplaceEngine", pdf = False, docx = True)
(9) Finally, please enter delete to clear the settings you just applied, and then you can return to step (5) to repeat the modification of other files.
document.delete()
Licensing
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) by default.
An alternative MIT License is available under the following conditions:
-
The user has completed a remittance of any amount to the bank account specified in: docs/Inward-remittance-instruction2025.11
-
The user has sent a notification email to: startime_electronics@orztrickster.com for record-keeping purposes only.
Upon fulfillment of the above conditions, the user is automatically granted a separate MIT License for this project.
No explicit confirmation or reply from the author is required for the MIT License to take effect. The completion of the remittance (regardless of amount) and the sending of the notification email constitute acceptance and fulfillment of the licensing conditions.
The full text of the MIT License applicable under these conditions is provided in the following file for reference: docs/LICENSE_MIT
In the event of any dispute, the user bears the burden of proving that both the remittance and the notification email have been completed.
Metadata
Release files for WordReplaceEngine 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wordreplaceengine-1.0.1.tar.gz | 23.3 kB | Without provenance | Details for wordreplaceengine-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wordreplaceengine-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for wordreplaceengine-1.0.1-py3-none-any.whl |
Total release size: 46.6 kB
Release files / wordreplaceengine-1.0.1.tar.gz
| Download URL | wordreplaceengine-1.0.1.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1792693e5bb7246351ef49e1186a8e2bd0c8831dedb4f8d712d063152e1ef8f6
|
|
BLAKE2b-256 checksum How to use checksums |
3ebfcd28e38c546ed3056079d06f6ddb90a47e2c06b43fcaccd9c958bffebf26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / wordreplaceengine-1.0.1-py3-none-any.whl
| Download URL | wordreplaceengine-1.0.1-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ff5d16c425f77fab264b293c0606adf5985887ffe5c3f9c46725af8c918d381
|
|
BLAKE2b-256 checksum How to use checksums |
0be90535938661aac3fb1648b5be6519dee5d0b9182d0e4539c7cc9c4f413a19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Security for WordReplaceEngine 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.