A project for adding an information block to an MS .docx file
Project description
About
This project was created to add additional information, specified in a certain format, to existing .docx files.
Features
- DOCX Processing: Automates the editing and formatting of DOCX documents.
- Flexible Configuration: Easily customize processing parameters to suit your specific needs.
- Seamless Integration: Integrates smoothly with other services and workflows thanks to its open architecture.
- Extensibility: A clear and modular code structure allows you to add new features or modify existing ones with ease.
Table of Contents
Installation
The project is available on the Python Package Index (PyPI), making installation simple and straightforward. To install, run:
pip install sbi-special-docx-master
Usage
# Import the AddDocx class from the sbi_special_docx_master module
from sbi_special_docx_master import AddDocx
# Import the Document class from the python-docx library
from docx import Document
# Specify the path to the DOCX file you want to open
add_file = "Your_file.docx"
# Load the DOCX file into a Document object
doc = Document(add_file)
# Create a dictionary with the information that will be added to the document.
# This dictionary contains a list under the key 'separate_information_relations'.
# Each item in the list is a dictionary with 'content', 'images', and 'title'.
info_dict = {
'separate_information_relations': [
{
'content': 'str', # Some text content
'images': [ # A list of images (each is a dictionary)
{
'file': '<Base64>' # Base64-encoded image string
}
],
'title': 'str' # Title for this section
},
{
'content': 'str', # Another text content
'images': [
{
'file': int, # This seems unusual; normally you'd expect a Base64 string here
}
],
'title': 'str'
}
]
}
# Initialize the AddDocx object with the document and the provided info dictionary
spec = AddDocx(doc, info_dict)
# Save the modified document to a new file
spec.save('my_file.docx')
# Optionally, call the method to save the document content to an IO stream.
spec.save_io()
# Retrieve the modified document from the AddDocx object.
doc_ex = spec.document
# Check whether the addition operation was successful.
doc_suc = spec.has_succeeded
Example
License
This project is licensed under the MIT License – see the LICENSE file for details.
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
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 sbi_special_docx_master-25.3.5.1.tar.gz.
File metadata
- Download URL: sbi_special_docx_master-25.3.5.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf98da5f1555830c3dbe63907efad629f7557e3b9782b51e85c5772efb81a49b
|
|
| MD5 |
758523da4df1b7726a397b313ef92d89
|
|
| BLAKE2b-256 |
e1a29e980b60f4b9bdfd520cca88e69591f427226c35c3ad98b5b63bfc0c6aee
|
Provenance
The following attestation bundles were made for sbi_special_docx_master-25.3.5.1.tar.gz:
Publisher:
python-publish.yml on TheDanielll/sbi_special_docx_master
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sbi_special_docx_master-25.3.5.1.tar.gz -
Subject digest:
cf98da5f1555830c3dbe63907efad629f7557e3b9782b51e85c5772efb81a49b - Sigstore transparency entry: 187247795
- Sigstore integration time:
-
Permalink:
TheDanielll/sbi_special_docx_master@1274a697feeea789e7295e707dc4a15443b2390c -
Branch / Tag:
refs/tags/25.3.5.1 - Owner: https://github.com/TheDanielll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1274a697feeea789e7295e707dc4a15443b2390c -
Trigger Event:
release
-
Statement type:
File details
Details for the file sbi_special_docx_master-25.3.5.1-py3-none-any.whl.
File metadata
- Download URL: sbi_special_docx_master-25.3.5.1-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc8bba8879dfce09f7b19c8d3210fb2a1f8785c6050f8012d6d3de83a90b0ac
|
|
| MD5 |
194cb26c152e2936175f89ac4039bcc9
|
|
| BLAKE2b-256 |
10b843c3cf3fd41cbdc089eeb3c0269c42e6c73321676c0f4ae686a043e61428
|
Provenance
The following attestation bundles were made for sbi_special_docx_master-25.3.5.1-py3-none-any.whl:
Publisher:
python-publish.yml on TheDanielll/sbi_special_docx_master
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sbi_special_docx_master-25.3.5.1-py3-none-any.whl -
Subject digest:
ccc8bba8879dfce09f7b19c8d3210fb2a1f8785c6050f8012d6d3de83a90b0ac - Sigstore transparency entry: 187247798
- Sigstore integration time:
-
Permalink:
TheDanielll/sbi_special_docx_master@1274a697feeea789e7295e707dc4a15443b2390c -
Branch / Tag:
refs/tags/25.3.5.1 - Owner: https://github.com/TheDanielll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@1274a697feeea789e7295e707dc4a15443b2390c -
Trigger Event:
release
-
Statement type: