MCPcopy
hub / github.com/open-xml-templating/docxtemplater

github.com/open-xml-templating/docxtemplater @v3.69.0 sqlite

repository ↗ · DeepWiki ↗ · release v3.69.0 ↗
588 symbols 1,351 edges 88 files 2 documented · 0%
README

docxtemplater

Download count Current tag CDNJS version size gzip size

docxtemplater is a library to generate docx/pptx documents from a docx/pptx template. It can replace {placeholders} with data and also supports loops and conditions. The templates can be edited by non-programmers, for example your clients.

docxtemplater is very robust because of the many fixed issues over the years, and the high quality of tests and code.

Features

Demo Site

Quickstart

Documentation

The full documentation of the latest version can be found here.

See CHANGELOG.md for information about how to migrate from older versions.

Modules

Functionality can be added with the following paid modules :

  • Image module to add a given image with the syntax: {%image};
  • Html Module to insert formatted text in a docx document with the syntax {~html};
  • XLSX Module to be able to do templating on Excel files (xlsx extension), also with loops and conditions;
  • Chart Module to replace a chart by using data from the JSON object that you give with the syntax {$chart};
  • Html-Pptx Module to insert formatted text in a pptx document with the syntax {~html};
  • Error Location Module to show the errors in the template using Word comments
  • Slides Module to create multiple slides dynamically with the syntax {:users};
  • Subtemplate Module to include an external docx file inside a given docx file with the syntax {:include doc};
  • Subsection Module to include subsections (headers/footers) from an other document with the syntax {:subsection doc};
  • Subtemplate-pptx Module to include an external pptx file inside a given pptx file with the syntax {:include doc};
  • Word-Run Module to include raw runs () inside the document with the syntax {r@wrun}. This makes it possible to include styled text without having to remove the enclosing paragraph like in the {@rawXml} tag;
  • QrCode Module to replace an image, keeping any existing properties;
  • Table Module to create tables from two dimensional data using the syntax {:table data};
  • Meta Module to make a document readonly, add a text watermark or update the margins;
  • Styling Module restyle a paragraph, a cell or a table depending on some data using the syntax {:stylepar style};
  • Footnotes Module to be able to add footnotes to a document using the syntax {:footnotes foot}
  • Paragraph Placeholder Module to simplify conditions that should show or hide a given paragraph using the syntax {?tag}

About docxtemplater

Docxtemplater is my main job, and has been maintained for over 8 years. Expect to get great support if you buy any modules, and also good support on the open-source version.

Extension points exported contracts — how you extend this code

SimplePart (Interface)
(no doc)
es6/docxtemplater.d.ts
FileTypeParams (Interface)
(no doc)
es6/docxtemplater.test-d.ts
ParserOptions (Interface)
(no doc)
es6/expressions.d.ts
ParserOptions (Interface)
(no doc)
es6/expressions-ie11.d.ts
Part (Interface)
(no doc)
es6/docxtemplater.d.ts
SetOptions (Interface)
(no doc)
es6/docxtemplater.test-d.ts
ExpressionParser (Interface)
(no doc)
es6/expressions.d.ts
ExpressionParser (Interface)
(no doc)
es6/expressions-ie11.d.ts

Core symbols most depended-on inside this repo

render
called by 164
es6/docxtemplater.d.ts
createDocV4
called by 110
es6/tests/utils.js
getFullText
called by 104
es6/xml-templater.js
content
called by 87
es6/tests/e2e/fixtures.js
createXmlTemplaterDocx
called by 59
es6/tests/utils.js
makeDocxV4
called by 59
es6/tests/utils.js
expectToThrow
called by 45
es6/tests/utils.js
shouldBeSame
called by 30
es6/tests/utils.js

Shape

Function 373
Method 161
Class 36
Interface 18

Languages

TypeScript100%

Modules by API surface

es6/tests/utils.js61 symbols
es6/docxtemplater.d.ts43 symbols
es6/doc-utils.js41 symbols
es6/docxtemplater.js40 symbols
es6/errors.js33 symbols
es6/modules/loop.js29 symbols
es6/tests/e2e/modules.js21 symbols
es6/tests/e2e/fixtures.js19 symbols
es6/tests/assertion-module.js19 symbols
es6/inspect-module.js17 symbols
es6/minizod.js16 symbols
es6/xml-templater.js14 symbols

Dependencies from manifests, versioned

@arethetypeswrong/cli0.18.2 · 1×
@babel/cli7.28.3 · 1×
@babel/core7.28.3 · 1×
@babel/eslint-parser7.28.0 · 1×
@babel/preset-env7.28.3 · 1×
@stryker-mutator/core9.0.1 · 1×
@stryker-mutator/mocha-runner9.0.1 · 1×
@stylistic/eslint-plugin-js4.4.1 · 1×
@xmldom/xmldom0.9.10 · 1×
angular-expressions1.5.4 · 1×
babel-loader10.0.0 · 1×
chai4.5.0 · 1×

For agents

$ claude mcp add docxtemplater \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact