GroupDocs.Assembly for .NET API supports the removal of paragraphs becoming empty after template syntax tags are removed or replaced with empty values. A new member RemoveEmptyParagraphs is added to DocumentAssemblyOptions. When this new option is applied to DocumentAssembler options through DocumentAssembler.Options, the engine additionally removes empty paragraphs.
Removing Empty Paragraphs in Word Processing Document
Removing Empty Paragraphs in Spreadsheet and Plain Text Documents
Note
This feature is supported by version 26.11 or greater.
In spreadsheet templates and plain text documents, a paragraph is a line of text: a line of a cell’s text, or of a text document, that becomes empty after template tags are removed or replaced with empty values is removed together with its line break. Tags such as <<if>> and <<foreach>> written on their own lines no longer leave empty lines behind.
Prefix
<<[""]>>
Suffix
Prefix
<<if [false]>>
Text to be removed
<</if>>
Suffix
Result:
Prefix
Suffix
Prefix
Suffix
The same template text in a cell of a spreadsheet gives the same result within the cell. Example: RemoveEmptyParagraphs.cs, which assembles the DOCX, PPTX, MSG, XLSX and TXT variants.