GroupDocs.Assembly can remove paragraphs that become empty after template syntax tags are removed or replaced with empty values. To enable this, apply the DocumentAssemblyOptions.REMOVE_EMPTY_PARAGRAPHS option to a DocumentAssembler instance through DocumentAssembler.setOptions().
DocumentAssemblyOptions members are exposed in Node.js as plain numbers (bit flags), so several options can be combined with the bitwise OR operator:
Consider a template with the following paragraphs:
Prefix
<<[""]>>
Suffix
Prefix
<<if [false]>>
Text to be removed
<</if>>
Suffix
Without the option, the paragraphs that held the <<[""]>> and <<if>> tags stay in the report as empty lines. With REMOVE_EMPTY_PARAGRAPHS applied, they are removed, while paragraphs that were already empty in the template are kept:
Prefix
Suffix
Prefix
Suffix
Removing empty paragraphs in a Word Processing document
The template does not reference any data, so a dummy data source is passed.
Removing empty paragraphs in a Presentation document
The option works the same way for presentation templates: use the code above with a PPTX template (for example, Empty Paragraph.pptx) and a PPTX output file.