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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for sbi_special_docx_master-25.3.5.1.tar.gz
Algorithm Hash digest
SHA256 cf98da5f1555830c3dbe63907efad629f7557e3b9782b51e85c5772efb81a49b
MD5 758523da4df1b7726a397b313ef92d89
BLAKE2b-256 e1a29e980b60f4b9bdfd520cca88e69591f427226c35c3ad98b5b63bfc0c6aee

See more details on using hashes here.

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

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.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sbi_special_docx_master-25.3.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ccc8bba8879dfce09f7b19c8d3210fb2a1f8785c6050f8012d6d3de83a90b0ac
MD5 194cb26c152e2936175f89ac4039bcc9
BLAKE2b-256 10b843c3cf3fd41cbdc089eeb3c0269c42e6c73321676c0f4ae686a043e61428

See more details on using hashes here.

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

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