Skip to main content

A project for adding an information block to an MS .docx file

Project description

Documentation

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

Example Image

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

sbi_special_docx_master-25.3.6.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

sbi_special_docx_master-25.3.6-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file sbi_special_docx_master-25.3.6.tar.gz.

File metadata

  • Download URL: sbi_special_docx_master-25.3.6.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

Hashes for sbi_special_docx_master-25.3.6.tar.gz
Algorithm Hash digest
SHA256 0cffab20b30d2ba40fd4708cae44c6a7b6096570541f7746bd7ce9a015e67489
MD5 a1e39e2efbdf737efc60155b1957673b
BLAKE2b-256 2b96b13fea40ee17e89b9723ca04d2c0375325cd568f92226d88b90a76ec22e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbi_special_docx_master-25.3.6.tar.gz:

Publisher: python-publish.yml on TheDanielll/sbi_special_docx_master

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sbi_special_docx_master-25.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for sbi_special_docx_master-25.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 19de6e48b0f11b25268ec9d0ffcc8f1671b76330cd7526815534a3926f63d255
MD5 c8f198b4f1c44f7415d20bdab3cfbd6a
BLAKE2b-256 3f2dab7a1f79c313ac6b7cc3b93b86b9f11d251adbaae20854e94719d796dd99

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbi_special_docx_master-25.3.6-py3-none-any.whl:

Publisher: python-publish.yml on TheDanielll/sbi_special_docx_master

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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