Package Exports
- docx-template
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (docx-template) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
docx-hub
create personalized docx from docx template and data
supported variants following javascript language
any javascript expression
richtext form control's text content with pattern ${...}
if(...)[with][{...}]
richtext form control's tag with pattern if(...)[with][{...}]
for(;;)[with][{...}]
richtext form control's tag with pattern for(;;)[with][{...}]
picture variable
picture form control's tag with expression pattern ${...}
API
parse(template.docx): for multiple assembly
return Promise, resolved with a VariantDocx with following api * assemble({}/data/,transactional?) * variantChildren
assemble(template.docx, {}/data/): for transactional assembly
return Promise, resolved with a new docx with following api
* save(filename?): save to file for nodejs
* parse([...docx4js compatible visitor factories])
* variantChildren
* data: jszip docx dataExample
Transactional
require("docx-hub")
.assemble(input.files[0],{name:"test"})
.then(assembled=>assembled.save)Batch
let docxhub1=require("docx-hub").parse(input.files[0])
docxhub1.assemble({name:"John"})
.save()
docxhub1.assemble({name:"Mike"})
.parse(require("docx2html").factory)
dochub1.assemble({name:"Jason"})
.save()