javascriptdocxtemplater

How to put linebreak after text with docxtemplater


I'm using the docxtemplater module to fill template on a MS Word document. I've used this, but it just add space to the template:

var EOL = "\n";
var willBeTemplated = "Something" + EOL;

How can I put a line break after this text?


Solution

  • I'm the creator of docxtemplater.

    You can use the following code :

    const doc = new Docxtemplater(zip, {linebreaks: true});
    

    By default, docxtemplater does'nt take into account linebreaks, but with this option it will add them.

    https://docxtemplater.com/docs/faq/#inserting-new-lines