JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q72766F
  • License GPL

customizing docx template with data

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-template

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)

return Promise, resolved with a VariantDocx with following api * assemble({}/data/): 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")
})