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.12.tar.gz
(11.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.12.tar.gz.
File metadata
- Download URL: q2data2docx-0.1.12.tar.gz
- Upload date:
- Size: 11.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 |
c0e8ad17aad65ae0ce7a72caca7a223ab7f82e602f31c2976f37cc69d3447c62
|
|
| MD5 |
870b9ae1716aa8774738fc07dc85f9d1
|
|
| BLAKE2b-256 |
36df511f0135fa4f6aeac9cf716d986ee209ab6b87698833de6e36446f84e053
|
File details
Details for the file q2data2docx-0.1.12-py3-none-any.whl.
File metadata
- Download URL: q2data2docx-0.1.12-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 |
f3c31b1d33c707421f7a103150b37f80b086798108f43a0dbed0e72c6b351055
|
|
| MD5 |
37b76a289c5b926738bfeaae0e9d105d
|
|
| BLAKE2b-256 |
380a270a869f9b6867eff81a6da64c6218c9e78754d9ab103d870f0b440e6d3d
|