You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When commands are included inside a text field, docx-templates processes the command twice. This results in the command appearing twice in the command list and being executed twice. Although the final output appears correct, this redundancy leads to unnecessary parsing, thereby increasing resource usage.
Steps to Reproduce
Create a DOCX file with a docx-templates-command inside a text-field
Use the listCommands function to parse the template.
Observe the command list output.
Sample
In the provided sample, the first two commands ("artist project ID" and "Bezeichnung") are correctly listed once. However, the third command ("Titelbild"), despite being present only once in the document, is returned twice by listCommands.
@Amerlander Thanks for your detailed report. I'll try to reproduce this when I have time. On the face of it, I expect that this happens because of how Word structures text box-related data in the underlying XML.
Description
When commands are included inside a text field,
docx-templates
processes the command twice. This results in the command appearing twice in the command list and being executed twice. Although the final output appears correct, this redundancy leads to unnecessary parsing, thereby increasing resource usage.Steps to Reproduce
listCommands
function to parse the template.Sample
In the provided sample, the first two commands ("artist project ID" and "Bezeichnung") are correctly listed once. However, the third command ("Titelbild"), despite being present only once in the document, is returned twice by
listCommands
.Code
Docx-File
Test (3).docx
Docx-Screenshot
Output
Expected Behavior
Each command should appear only once in the command list, reflecting its single occurrence in the document.
Actual Behavior
Commands within text fields are listed and executed twice, resulting in duplicated entries in the command list.
Environment
Library Version: https://unpkg.com/docx-templates/lib/browser.js
Browser: Opera One (Version: 111.0.5168.25)
OS: Windows 11
The text was updated successfully, but these errors were encountered: