if (startBookmark != null) {
// Start bookmark exist
RTFBookmark endBookmark = (RTFBookmark) bookmarkEndMap
.get(endBookmarkName);
String newContent = getMacroEndForEach(); // "#end";
RTFPage page = (RTFPage) pageBeforeEndBookmarkMap
.get(endBookmarkName);
if (page != null) {
String content = null;
if (groupByPerPageBreak > -1) {
// Content must be group by
// There is a page break defined into RTF and group by
// per page is defined
content = " "
+ getMacroPageBreak(startBookmark
.getItemNameList(), page
.getRTFFirstContentOfElement(),
groupByPerPageBreak) + " ";
} else {
// There is a page break defined into RTF
// and group by per page is not defined
content = " "
+ getMacroPageBreak(startBookmark
.getItemNameList(), page
.getRTFFirstContentOfElement()) + " ";
}
page.replaceElement(content);
} else {
if (groupByPerPageBreak > -1) {
if (lastEndLoopRTFBookmark != null
&& lastEndLoopRTFBookmark.equals(endBookmark)) {
newContent = getMacroPageBreak(startBookmark