mod_docx
The purpose of this library is to serve as a reliable and simple library to reassemble docx documents after they have been treated using AI/machine learning text treatment.
Example of library usage
import os
import sys
sys.path.insert(1, '/usr/lib/python3.11/site-packages')
import mod_docx
[Step 0] Open the docx file as an XML object
Obtain the orignal docx file
fpath = ".../mod_docx/tests"
fichier = "test_document.docx"
docx_filename = os.path.join(fpath, fichier)
Create a class object for the name_of_file.class_name. Use the class object, to call the functions in the class.
md = mod_docx.mod_docx(docx_filename)
Convert the orignal docx file to XML
document_org = md.opendocx(docx_filename)
[Step 1] Modify the document
[To be completed for next version] Modify the document as desired (ie: replace text, change style, change font)
doc_finale = document_org
[Step 2] Save the changed XML document as a docx file
root_dir = f'{fpath}/'
desired_output_docx_name = 'test_document_out.docx'
md.savedocx_ver_fichier(docx_filename, root_dir, desired_output_docx_name, doc_finale)
Metadata
Release files for mod-docx 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mod_docx-0.1.0.tar.gz | 17.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mod_docx-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / mod_docx-0.1.0.tar.gz
| Download URL | mod_docx-0.1.0.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12199685cacdf93eeea907626a8c893c8cba039e9b5e3fd439d727215640397b
|
|
BLAKE2b-256 checksum How to use checksums |
048641076a2d05cccaa7dec28906013c0173fec2e0a6e276044b35a029451db2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / mod_docx-0.1.0-py3-none-any.whl
| Download URL | mod_docx-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5390696f01b0c3c6abf39f0de7c0711320a8da4d37404b5f571ee5681143ffa6
|
|
BLAKE2b-256 checksum How to use checksums |
4a31b14fb27fb3c1dd13bb458fbdea0c7e2fd4cac7c705399cf6e8d4c05ea036
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|