-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LINK inside FOR throwing 'INTERNAL_ERROR' in v4.1.1 #133
Comments
Hmmm, thats weird. Do you have a minimal repro case? Including the template please. I already tried to reproduce this in #83, and I made a regression test for this. The template that this test uses is https://github.com/guigrpa/docx-templates/blob/master/src/__tests__/fixtures/link-regression-issue-83.docx |
…ssue likely caused by a corrupted template.
…ssue likely caused by a corrupted template.
Thanks. When opening your template ( I tried to build a reproduction case by copying the text contents of your template into a new Word file, see 02271fe. Weirdly, this test passes without a problem... Any ideas what the cause might be? |
I was using 2010 version and also I tried with 2016 and still having the same error. Weird! cause other features(html,images,loop,conditions,link outside loops ...) are working as expected except links in loop. :/ |
I'll close this for now as I'm pretty sure this involves a corrupted template.. I'm sorry I couldn't help you out further. Please let me know if you find out more! |
It happens to me as well. Im using most recent office version. I found work around using the |
@DvirH can you post a reproduction case with a template and some code? |
Here it is... I've uploaded it to my repo I'm using 4.4.0 version (the last on npm) |
…ssue possibly caused by a corrupted template?
…LINK commands that are formatted (e.g. bold). Thanks @DvirH for providing an example.
…LINK commands that are formatted (e.g. bold). Thanks @DvirH for providing an example.
@DvirH @chelbighofrane Thanks for your examples! After a bit of experimentation, it seems that the I'll try and get a fix in, but note that the affected code is pretty deep in the lib and fully grasping what goes wrong may take a while. |
A short term fix/hack would be to remove all formatting from the affected LINK command in your template. |
@guigrpa can you maybe give me a pointer here? I stared at this code for a while, but I couldn't find what's going wrong here. The docx-templates/src/processTemplate.ts Lines 326 to 329 in ddeb00b
I have confirmed that this error occurs when LINK commands are formatted (e.g. bold/underlined) and placed within a FOR loop (see example template here 9b9d84c) Would be great if you could point me in the right direction! |
Hmm, it looks like the input and output trees have gotten out of sync. When the next move is to the Since you mention that it happens only within a loop, maybe I think it would pay to execute it step by step, watching input and output pointers as they move… |
…LINK commands that are formatted (e.g. bold). Thanks @DvirH for providing an example.
…LINK commands that are formatted (e.g. bold). Thanks @DvirH for providing an example.
…commands that are formatted (e.g. bold). Thanks @DvirH for providing an example.
Fix released in v4.7.0. Should be on NPM shortly. Let me know if you encounter any weirdness! |
Unfortunately the error still occurs in version 4.1.1
The text was updated successfully, but these errors were encountered: