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

docx-template

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docx-template

customizing docx template with data

  • 2.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
60
increased by42.86%
Maintainers
1
Weekly downloads
 
Created
Source

docx-template

create personalized docx from docx template and data

supported variants following javascript language

any javascript expression

*plain text form control's tag with pattern ${...} *plain text form control's content with pattern ${...}

picture variable

picture form control's tag with expression pattern ${...}

if(...)[with][{...}]

richtext form control's tag with pattern if(...)[with][{...}]

for(;;)[with][{...}]

richtext form control's tag with pattern for(;;)[with][{...}]

sub document

  • dynamic: richtext form control's tag with pattern include(exp:subdoc url)
  • embed: richtext form control's tag with pattern include(), and content is embeded word ole object

import javascript code

richtext form control's tag with pattern script(...), and content is embeded javascript ole object

API

parse(template.docx)

return Promise, resolved with a VariantDocx with following api * assemble({}/data/, {clearWrap=true/default clear sdt/}/option/): return Promise resolved docx4js instance

Example

import docxTemplate from "docx-template"

docxTemplate.parse("~/template.docx").then(varDoc=>{
	let staticDocx=varDoc.assemble({name:"foo"})
	staticDocx.save("~/static.docx")
})

Todo

  • support javascript file for functions
  • inline subdoc

License

GPL

Keywords

FAQs

Package last updated on 04 Jun 2020

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