Merging data (XLSX, JSON) and template (DOCX) into resulting DOCX document
Project description
Usage
import
import q2data2docx.q2data2docx
merge local files
d2d = q2data2docx.q2data2docx.q2data2docx()
d2d.loadJsonFile("your-file-name.json") # JSON data file
# or
d2d.loadJsonFile("your-file-name.xlsx") # XLSX data file
d2d.loadDocxFile("your-file-name.docx") # DOCX template file
if d2d.merge():
d2d.saveFile("result")
if d2d.merge():
d2d.saveFile("result")
or
q2data2docx.q2data2docx.merge("your-file-name.docx", "your-file-name.json", "result")
# or
q2data2docx.q2data2docx.merge("your-file-name.docx", "your-file-name.xlsx", "result")
merge data from memory
d2d = q2data2docx.q2data2docx.q2data2docx()
d2d.setJsonBinary(open("your-file-name.json", "rb").read())
# or
d2d.setXlsxBinary(open("your-file-name.xlsx", "rb").read())
d2d.setDocxTemplateBinary(open("your-file-name.docx", "rb").read())
if d2d.merge():
d2d.saveFile("result")
or
d2d = q2data2docx.q2data2docx.q2data2docx(
docxTemplateBinary=open("your-file-name.docx", "rb").read(),
jsonBinary=open("your-file-name.json", "rb").read(),
)
# or
d2d = q2data2docx.q2data2docx.q2data2docx(
docxTemplateBinary=open("your-file-name.docx", "rb").read(),
xlsxBinary=open("your-file-name.xlsx", "rb").read(),
)
if d2d.merge():
d2d.saveFile("result")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
q2data2docx-0.1.19.tar.gz
(14.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file q2data2docx-0.1.19.tar.gz.
File metadata
- Download URL: q2data2docx-0.1.19.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44b13ed90756c29345597a90ebb6735ff04947a6174286e5494b1519c02d6289
|
|
| MD5 |
67d8430d041ded8e3ee389352d6ac05b
|
|
| BLAKE2b-256 |
b99de98cde5fcb904b256a7f031a7428b48697f3e744a5eff693be6eee01dec4
|
File details
Details for the file q2data2docx-0.1.19-py3-none-any.whl.
File metadata
- Download URL: q2data2docx-0.1.19-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2b2b88fec1704a054b8e005d2573f6583425ee6ea9be1c807948ede5b5dc2a9
|
|
| MD5 |
d747a95efd68e9e61a99b460bf552cae
|
|
| BLAKE2b-256 |
7af6e0a4e301e948c67b20532562f6ee39c68a419f99a67a5613f09736f8bfee
|