guigrpa / docx-templates

Template-based docx report creation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nodes missing in generated document (IF command)

marzn opened this issue · comments

General description

We discovered a bug, which resulted in missing elements we would expect to be in the output. For example the following template generates an empty document:

Screenshot template

Used template: node-removal.docx

Debugging results

While debugging I found the reason in processTemplate.ts:252. In the example above the node containing the text "Should appear in the output" is in the tree below the last sibling, which means it gets removed. The selected node in the screenshot is the last sibling and therefore this node and its children will be removed by L252.

Screenshot debugger

Possible workaround

A newline before each END-IF