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
7
votes
3 answers

Can't resolve 'fs' using webpack and react

I keep getting the error in the description when I try to build my application for my Node server. I am ultimately trying to read a .docx file for docxtemplater, but without 'fs' working, it's not looking to bright. I have tried to use the…
Jenna
  • 71
  • 1
  • 1
  • 2
5
votes
2 answers

How do I create a zip file with multiple docx files generated by the "docxtemplater"?

Recently, I have been asked to make a tool that should automatically generate .docx files using a given template once we feed data to it. After some thinking, I eventuall opted for the docxtemplater, and I did manage to generate a .docx file, with…
3
votes
1 answer

Getting Docxtemplater is not defined in JS in the browser

I am trying to make a website with which I can change the words in my template. I uploaded the docx.docx file to my folder where all the files are located like a index.html. There are 3 labels in my file : …
Ruslan Li
  • 33
  • 3
3
votes
1 answer

React js view docx blob file

I can create a docx file of type blob using the following module docxtemplater, and then give the user the possibility to download the docx file. In this way: var zip = new PizZip(content); var doc = new Docxtemplater().loadZip(zip); ... var out =…
Paul
  • 3,644
  • 9
  • 47
  • 113
3
votes
3 answers

Newlines or break tags with docxtemplater

I am using docxtemplater to convert JSON data to word document. Document is generating fine. var sections = {"sections":[{"section_name":"Languages","data":"Tamil\nTelugu\nHindi\nEnglish","key":"8783"},{"section_name":"Skills","data":"JavaScript
Jagan K
  • 1,057
  • 3
  • 15
  • 38
3
votes
4 answers

handle undefined values in docXTemplater or javascript object array

I have an object array that will be exported to word document via DocXTemplater Sample array [ {Name:"jon doe",age:27} {Name:"joe roe",age:27,Address:"new jersey"} ] Now the DocXTemplate will…
Vignesh Subramanian
  • 7,161
  • 14
  • 87
  • 150
2
votes
0 answers

Converting BLOB (docxtemplater) to PDF - REACT

Hello everyone I am developing a website using React.js and Node.js where I generate a word document from the user's input and thats worked just fine with docxtemplater! The problem is I want to let the user download the word document direclty as a…
Elodie Muller
  • 103
  • 2
  • 14
2
votes
1 answer

how to change direction of text from ltr to rtl in docxtemplater?

I'm inserting text into a Microsoft Word document using the docxtemplater module. I'm having trouble inserting Arabic text. doc.setData({ country: 'الهند' }); output
nawaz uddin
  • 345
  • 2
  • 14
2
votes
2 answers

Error: Can't find end of central directory : is this a zip file ? in React & docxtemplater

I am facing an issue in using docxtemplater library to generate a doc file from my react application. If anybody know how to solve this please help me. import React from "react"; import Docxtemplater from "docxtemplater"; import PizZip from…
SivaRoy
  • 21
  • 3
2
votes
1 answer

React js read the text of a doc/docx file

I need to read the contents of a doc/docx file, which is uploaded by the user. I've tried using jszip with docxtemplater, but I'm unable to read the file. If besides the docs/docx files it could also read the txt files, that would be great. I have a…
Paul
  • 3,644
  • 9
  • 47
  • 113
2
votes
2 answers

How can I output a docx from docxtemplater.js for input in jszip

Using the examples from jszip and docxtemplater I am trying to add multiple docx-Documents to a zip archive and I am failing. My archive only contains docx-files with 0 Bytes that are not readable. I think I don't understand how I can add the…
timm
  • 76
  • 1
  • 7
2
votes
1 answer

Angular2 downloaded docx response body is empty

I'm using Angular2 to download a generated .docx file from my express server. The file is generated by a tool and saved on the server, and then sent to the frontend. My browser logging says that the length of the result is larger than 0, but the…
Robin
  • 163
  • 2
  • 8
2
votes
2 answers

Docxtemplater. Nested objects

I'm using https://github.com/open-xml-templating/docxtemplater My data: var person = { name: 'Joe', address: { city: 'Stockholm', postal: 45123 } } How do write the syntax in the docx with this nested object? This is not…
Joe
  • 4,274
  • 32
  • 95
  • 175
2
votes
1 answer

Docxtemplater inserting plain xml

I am using DocxTemplater library by edi9999 as a solution for creating .docx reports from template and JSON data, and I am happy with this. However, now I have to highlight some words in my reports. For example, I need to substitute {contents} with…
Mixo123
  • 71
  • 1
  • 8
1
vote
0 answers

I cannot solve Error: Can't find end of central directory : is this a zip file ? in React & docxtemplater

i'm trying to implement docxtemplater in my react app to generate a word doc file however i keep getting this error. in this code, a word docs is suppose to be generated when handleConvert is called. i'm using the template exactly from the docs from…
pauzi
  • 11
  • 1
1
2 3 4