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.4.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.4-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sbi_special_docx_master-25.3.4.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.4.tar.gz
Algorithm Hash digest
SHA256 bb66702c6d13ef929bda9e8197aa158a6a9dd1c982a0480b48d35fc59d948a44
MD5 91e214aa4a206d8e734a4c5fc3d340ae
BLAKE2b-256 c650485716396f86adfedf7b5ba1390f863cb256325d7bf154c87c457b34b81d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbi_special_docx_master-25.3.4.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.4-py3-none-any.whl.

File metadata

File hashes

Hashes for sbi_special_docx_master-25.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f043b296b93ceec0f6c74b038af311c539c7393ef488d7b74cf1958766148001
MD5 87522cab5cbda2e9a19708c006aaebda
BLAKE2b-256 a705b2d44bba29169623bcc5a0ed4939d5dda70dcbb402c5c3c36d08e4fe72e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbi_special_docx_master-25.3.4-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