Skip to main content

module to ease the docx report generation using templates and importing features

Project description

pyDocxReport

Ease the docx report generation using templates and importing features

DataBridge

DataBridge class manages resources and match them with keyword set in a template docx file.
All keywords in the template so referenced ar replaced by the appropriate content.
An example of use with a yml file as a matchs dictionary is given below:

bridge = DataBridge('path/to/template.docx')
matchs['_keyword2_'] = {
                            'type': 'table',
                            'replacement': df1,
                            'header': False
                        }
bridge.match(matchs)
bridge.save('path/to/output.docx')

where matchs is defined as a yml file like below:

_keyword1_:
    type: string
    replacement: text1
_myimage1set_:
    type: images
    replacement: 
        - path/to/image1.png
        - path/to/image2.jpg
    width: 120
_logo_:
    type: images
    replacement: path/to/logo.png
    height: 10
_keyword2_:
    type: table
    replacement: table1
    header: false               # if header is true, the column names of the DataFrame are used as header. Otherwiser no header. Default is no header
_text2_:
    type: string
    replacement: text2

See tests to see this example implemented.

DocxTemplate

The DocxTemplate class makes use of python-docx to modify a word document. Use DataBridge for a standard operation and use DocxTemplate when you need to tune some replacements.

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

pyDocxReport-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

pyDocxReport-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file pyDocxReport-0.1.0.tar.gz.

File metadata

  • Download URL: pyDocxReport-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.4

File hashes

Hashes for pyDocxReport-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f58c2246530bae90d914b692ef6a62f0f8a8d2be406ab6040c000b929b5da656
MD5 93583f91097fd58362338e13a84165a1
BLAKE2b-256 b67775ea5f4d5f4b6413717fd7ad94e4e2fb74fe391b62417782975fe2598d31

See more details on using hashes here.

File details

Details for the file pyDocxReport-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyDocxReport-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.4

File hashes

Hashes for pyDocxReport-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 929096bdf4c8fc839ebfe52712f8603f00e86a5a85b2d4d174d54e3a6eb47ae1
MD5 259fd54b4217240cf5061227634b84c5
BLAKE2b-256 b0aceef0dc92e6de4a22c42f84f9eb3df60746351af5f9bd3ad15b7466a5b19a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page