docx-templates icon indicating copy to clipboard operation
docx-templates copied to clipboard

Double pipe character in data causes corruption

Open MattCrum1 opened this issue 7 months ago • 1 comments

I have a fairly simple document template with a for loop, using INS to write into the document for each element in a JSON array.

Works fine - until my incoming JSON data includes a double pipe character "||" in a value.

The docx-templates function completes with no errors and the Word document is created, but it is corrupted and cannot be opened in Word. Tried opening it in a text editor and it says that the docx file is unreadable/binary data.

Guessing the docx-templates function is reading || as an OR switch and halting after processing that element of the array - is there any additional logging that I can enable to prove this? Do you know of a function switch that will allow literal "||" to be printed into the Word document - or do I need to escape it somehow?

Thanks in advance

MattCrum1 avatar Jul 12 '24 15:07 MattCrum1