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
Built Distribution
File details
Details for the file pyDocxReport-0.0.2.tar.gz
.
File metadata
- Download URL: pyDocxReport-0.0.2.tar.gz
- Upload date:
- Size: 4.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11dff6faebaf2dfca4ad3ca3ad59d15acd200791ad34ea8c7a27cb27685bfff3 |
|
MD5 | f20afb4903f61bc497d6d665c83c33e5 |
|
BLAKE2b-256 | f65f21cda305c3d0730e5badbefa8c326b929618e1bed5501e423705673280df |
File details
Details for the file pyDocxReport-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pyDocxReport-0.0.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4845bd90e64b6e9ed20dc9deeedc636786bb3f304e736baf09ba63c84203398f |
|
MD5 | 22dcf663a2af427b6ed346c89421d92c |
|
BLAKE2b-256 | 2c9b1f4e69f8fbfd4839e0d421eeef70895e00c1e2236d52dd51179d73f3d826 |