open-xml-templating / docxtemplater

Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js or the browser. Demo: https://www.docxtemplater.com/demo. #docx #office #generator #templating #report #json #generate #generation #template #create #pptx #docx #xlsx #react #vuejs #angularjs #browser #typescript #image #html #table #chart
https://www.docxtemplater.com
Other
3.07k stars 350 forks source link

Error: New Delimiters cannot be parsed #755

Closed bacps closed 4 months ago

bacps commented 4 months ago

Environment

How to reproduce my problem :

I am getting the error New Delimiters cannot be parsed when using as delimiters [].

My template is the following : generated.docx

How to replicate :

By using your online demo: https://docxtemplater.com/demo/#/view/simple

Uploaded the docx shared and in advanced options change the Delimiters to be [user]instead.

I would expect it to :

edi9999 commented 4 months ago

Hello @bacps ,

I understand, this happens because {= is reserved for changing the delimiters.

https://docxtemplater.com/docs/tag-types/#set-delimiter

So [={{ }}=] will change the delimiter from "[" and "]" to "{{" and "}}".

edi9999 commented 4 months ago

I have just released a new version, 3.48.0

With this version, you can disable completely this special behavior of the "=" string, you can use it in your code like this :

const doc = new Docxtemplater(zip, {
  syntax: {
    changeDelimiterPrefix: null,
  },
});