Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docx-hub

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docx-hub

personalized docx with data

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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 data

Example

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()

Keywords

FAQs

Package last updated on 25 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc