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.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.