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.9.tar.gz
(11.3 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.9.tar.gz.
File metadata
- Download URL: q2data2docx-0.1.9.tar.gz
- Upload date:
- Size: 11.3 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 |
9d9bed2bffa30d3cdd971b61f6d1e250f9e233709de461bb411a8b8cd4e14941
|
|
| MD5 |
7ed47609d89aee7504ad873a6d0e2349
|
|
| BLAKE2b-256 |
4d30a2f86c60b86804f6ab8c0f42098607bbd034d7b1578ad8a63f303b93c05c
|
File details
Details for the file q2data2docx-0.1.9-py3-none-any.whl.
File metadata
- Download URL: q2data2docx-0.1.9-py3-none-any.whl
- Upload date:
- Size: 12.1 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 |
c5b372c6747b1e6334412619fcffcbea60ee64c07e311352e300818288364a71
|
|
| MD5 |
7906f9d6950db18f95b5ef6ef62ef673
|
|
| BLAKE2b-256 |
1530285dae2838d254ef6d02cf23d4a8c9525fbf1ed29ad1e1cda5a8e3926aa2
|