Questions tagged [docxtemplater]

docxtemplater is a Javascript software library that allows to do some templating on the docx and pptx format. https://github.com/open-xml-templating/docxtemplater

docxtemplater can be used to replace placeholders in a word document.

With following document :

Hello {name} !

and following data as JSON :

{ "name" : "John" }

After templating, the document will contain :

Hello John

docxtemplater supports simple replacing, but also loops, conditions and raw xml insertion

56 questions
0
votes
0 answers

how to integrate docx instance from Docx library into template for Docxtemplater

const document = new Document({ sections: sections, }); const file = new File([Packer.toBlob(document)], "Seminar-template.docx", { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }); …
0
votes
0 answers

docxtemplater - Is it possible to show previews after rendering tags?

The website https://docxtemplater.com/demo/#simple has a simple demo where they have previews of the document before and after rendering. Does the tool have functions to show previews of the rendered documents? Referring to the template and output…
L C
  • 1
0
votes
1 answer

Docxtemplater - Javascript - hightlight undefined values

I'm using docxtemplater to create a word document based on JSON values (using surveyJS). In case some questions are not answered, the variable shows "undefined" in the final document. How can I make sure that any "undefined" output is highlighted? I…
0
votes
0 answers

Is there a way to provide default values within the template when generating documents?

I manage multiple contract templates and need to programmatically create documents with the relevant user data. Each contract template has different sets of parameters, and some contract templates may have more than 100 different parameters. For…
Fab
  • 11
  • 1
0
votes
0 answers

Docxtemplater. Links in v3

Is there any way to add link in doc to Docxtemplater v3? I found this package https://github.com/sujith3g/docxtemplater-link-module. But that only works in v2.
Joe
  • 4,274
  • 32
  • 95
  • 175
0
votes
0 answers

Looping over images with docxtemplater-image-module@3.1.0

I want to export an x amount of images coming from a dynamic array. How is it possible? So far it's only exporting the last value of the array. I'm guessing something related to this but what am I missing? images = [{image: image1, image: image2,…
0
votes
1 answer

Add a PDF into a word document using docxtemplater

Is there any possible way to add an existing PDF-File into a word document using docxtemplater (e.g. in connection with survey.JS) Manually you can do this within Word by selecting > Insert > Object > Create From File > Browse the PDF you want to…
0
votes
0 answers

Get text from a docx file in react js

As the title states, I am trying to get the text from a docx file I store locally in my src folder. Currently I am using Docxtemplater to get text in the following way: import Docxtemplater from "docxtemplater"; import PizZip from "pizzip"; import…
nCis
  • 68
  • 10
0
votes
1 answer

Docxtemplater (browser) strings and numbers in conditions not working

https://docxtemplater.com/docs/installation/#browser-js-files Hi, I am working on the latest release (also tried with 3.31.2 and 3.9.9 but when I define the following variables: // Render the document (Replace {first_name} by John, {last_name}…
Mauro
  • 102
  • 14
0
votes
1 answer

I am using Docxtemplater to apply an image to docx file but it return error:"Cannot read properties of undefined (reading 'part')"

const content = fs.readFileSync( path.resolve(__dirname, "../Template/quote2.docx"), "binary" ); // console.log(content); const imageOpts = { centered: false, fileType: "docx", getImage: function (tagValue, tagName) { …
vhg2901
  • 11
  • 4
0
votes
1 answer

What filetype do I need to make image in docs to work?

I use docxtemplater to place my image in docx file but it keeps ending up an error image I tried sending it as filelist, base64 , buffer but it never works this is my code, thank you in advanced. export const generateDocument = async (data, file,…
David Shu
  • 13
  • 3
0
votes
1 answer

Docxtemplater read a word file with line break

I have a word file, which I need to read, but using doc.getFullText() newlines are not read. How can I do?
Paul
  • 3,644
  • 9
  • 47
  • 113
0
votes
1 answer

Multiplication in docxtemplater

I want value of A*B. I tried {A *}{B}, {A=A+B} and {A*B}. Its not working. Can anyone please suggest what has to be done.
ABC
  • 212
  • 4
  • 16
0
votes
1 answer

Docxtemplater CORS policy on webserver

I am trying to build a little website where i need to use Docxtemplater. (https://docxtemplater.com/) This is a node module used to edit word documents (.docx). In the docs (https://docxtemplater.com/docs/generate/), it is stated "Please note that…
MATTI
  • 9
  • 5
0
votes
0 answers

Error when trying to paste qrcode into docx document

I upload a docx file on the client and use fast-xml-parser to parse a docx file into xml, before that, using jszip, I open the document archive. const doc = fs.readFileSync(files.uploadFile.path); const zip = new JSZip(); await…