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.0.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pyDocxReport-0.0.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyDocxReport-0.0.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.11

File hashes

Hashes for pyDocxReport-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8657720008db473c0a7f415bfb3038f6e76dd3925fc8877c27158b7996a69bfd
MD5 19f5fb01a4563971240861c4d1f3d870
BLAKE2b-256 4315cd8c1c111c7180cba7d562201bf4d1009209f6da58634e563a5d53cad333

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyDocxReport-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.11

File hashes

Hashes for pyDocxReport-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4ed0a2392c744846674a3d3e2bd6fac6c038ed97536ad50d20fb11e97707ec35
MD5 e5dbcb7ce0627ab16812f72a98a31166
BLAKE2b-256 faa4ec6b17857291b13b7ffd795ed529cd88d3484642797e18c248cc88fa07cb

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