Closed alandsidel closed 3 weeks ago
I'm facing something similar. Didi you figure out what was the issue?
I'm facing something similar. Didi you figure out what was the issue?
Nope. My solution was to switch to a different library. Using easy-template-x now. Works like a charm.
I can reproduce it on my end, will investigate
Example here: https://github.com/dolanmiu/docx/blob/master/demo/93-template-document.ts
Been beating my head against the wall for a few hours here, can't understand what might be causing this issue.
I have a simple docx file taken from a larger file which has a few paragraphs containing mustache formatted tokens. When using the patcher only about half of the tokens can be replaced while the rest result in a "Token not found" error and I cannot find any rhyme or reason to why some work and some don't. I've tried changing their names, I've made the tokens all lower case rather than mixed case, changed the order that I give them to the patcher, etc. Nothing seems to work.
The code I'm using in the patcher for testing is as follows, I've cut it down as well to just the minimum needed to cause the issue.
resp.data
is the raw document (a blob from an axiosget
). If any of the commented sections are uncommented, the error occurs. I can't see anything wrong in the code or the template document, which I've also cut down for testing and attached.The error from the console (this is in a React app) is:
Any insights would be greatly appreciated. test.docx