Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
While building a report, some paragraphs containing only template syntax tags can become empty after the tags are removed or replaced with empty values. To remove such paragraphs from the report, you can apply the ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS option as shown in the following example.
ReportingEngine engine = new ReportingEngine();
engine.setOptions(ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS);
engine.buildReport(...);The difference in the engine’s behavior when the option is applied and not applied is illustrated by the following examples.
Example 1
Template document
Prefix
<<[""]>>
SuffixResult document without ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS applied
Prefix
SuffixResult document with ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS applied
Prefix
SuffixExample 2
Template document
Prefix
<<if [false]>>
Text to be removed
<</if>>
SuffixResult document without ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS applied
Prefix
SuffixResult document with ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS applied
Prefix
SuffixExample 3
Note – In this example, persons is assumed to be a data table having a field Name.
Template document
Prefix
<<foreach [in persons]>>
<<[Name]>>
<</foreach>>
SuffixResult document without ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS applied
Prefix
John Doe
Jane Doe
John Smith
SuffixResult document with ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS applied
Prefix
John Doe
Jane Doe
John Smith
SuffixThe same functionality can be applied to selective paragraphs only. To achieve this, you can prepend names of corresponding tags with exclamation marks as shown in the following template snippet instead of applying of the ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS option.
<<![...]>>
<<!doc [...]>>
<<!foreach [...]>>...<</foreach>>
<<!if [...]>>...<<elseif [...]>>...<<else>>...<</if>>For a tag with its name prepended with an exclamation mark, the engine treats a corresponding paragraph or paragraphs as if ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS was applied. For the rest of tags, the engine behaves as if ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS was not applied.
Q: How do I enable the removal of empty paragraphs for the whole report?
A: Set the ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS flag on the ReportingEngine before calling buildReport. This tells the engine to delete any paragraph that contains only template tags that resolve to empty values.
Q: Can I apply the removal behavior only to specific tags instead of the entire document?
A: Yes. Prefix the tag name with an exclamation mark in the template (e.g., <<![...]>, <<!foreach [...]>>). The engine will treat paragraphs containing those tags as empty, while other tags will follow the default behavior.
Q: Will a paragraph that contains whitespace or line‑break characters be removed when the option is enabled?
A: The engine treats a paragraph as empty if, after tag processing, it contains no visible characters. Whitespace and line‑breaks are ignored, so such a paragraph will still be removed.
Q: What happens if a paragraph contains both regular text and a tag that resolves to an empty string?
A: The paragraph is retained because it still contains visible text. The removal option only affects paragraphs that consist solely of tags (or tags that become empty).
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.