-
Notifications
You must be signed in to change notification settings - Fork 139
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
Comments in template in FOR cause 'unreadable content' when opening created Word doc #324
Comments
Great find! I agree that this is a bug. I checked in the XML of the corrupt .docx file that your test generates, and apparently each comment is connected to a piece of text in No easy fix comes to mind, though. |
Clear, thanks for looking into this! It probably won't need a fix, as I can't think of a use case for comments in a FOR loop, but good to know this can lead to issues. An easy workaround is available, we can just delete the comment in the FOR, or move it somewhere else out of the loop. That will solve the issue. |
@jjhbw as discussed
When a template contains notes in a FOR loop the creation of the document succeeds, but when you open the document Word shows a 'unreadable content' error.
A created a test for this here https://github.com/rbuhrs/docx-templates/blob/acf973a22cf9e4ed20d6ac8d2d4aec63bf981aef/src/__tests__/templating.test.ts#L133
It creates a document in the test directory, which shows the error when you open it in Word
The text was updated successfully, but these errors were encountered: