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.11.tar.gz
(11.4 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.11.tar.gz.
File metadata
- Download URL: q2data2docx-0.1.11.tar.gz
- Upload date:
- Size: 11.4 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 |
3d24d20d09e9afc15ea8cd339fdfb0f478fb63b4e49fe3996baae22cb371bcae
|
|
| MD5 |
3719f2d184fc8ccd9f04795dba7c8408
|
|
| BLAKE2b-256 |
2a31a2a7d7c018020990bd1e67d23bff9be4544199032106a46f1666b11d4f3e
|
File details
Details for the file q2data2docx-0.1.11-py3-none-any.whl.
File metadata
- Download URL: q2data2docx-0.1.11-py3-none-any.whl
- Upload date:
- Size: 12.2 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 |
758579491a0145bc2b926f2002cde9d5bb2a89141c0e0506f84d4978e18b11e4
|
|
| MD5 |
6713cef49ae878430a307df180af9a0c
|
|
| BLAKE2b-256 |
4ad0f8b1ccfba0cfde27125dc1afc0e197577ea2a5310554477a208a091a1dc9
|