IF tag issue in JOD Reports 2.2 and up

133 views
Skip to first unread message

Rashid Ali

unread,
Jul 10, 2012, 3:32:46 PM7/10/12
to jodrepor...@googlegroups.com
This is regarding an issue I recently found in JOD Reports 2.2 and up.

The problem is in filenet.sf.jooreports.templates.xmlfilters.TextInputTagFilter  and in method public void doFilter(Document document).

The problem appears when document template has a starting IF and ending IF tag. So if the text between the tags exceeds one page and ending tags moves to new page then Openoffice adds an extra tag called "soft-page-break". So if the condition fails, this causes thepublic void doFilter(Document document) method to remove the starting tag and leaves the ending tag in the document due to the condition to replace the tags. Following chunck of code fails.

while (childNode.getParent().getChildCount()==1) {
                        childNode = childNode.getParent();
}

if I replace the above code as below, it starts working fine. First of all, do you find this solution useful, secondly how this solution can be added to the project. Please advise.

                    while (childNode.getParent().getChildCount()==1 || (childNode.getParent().getChildCount() == 2 && isChildSoftPageBreak(childNode.getParent()))) {
                        childNode = childNode.getParent();
                    }





private boolean isChildSoftPageBreak(ParentNode parent) {
        if(parent != null)
        {
            int n = parent.getChildCount();
            for(int i = 0; i < n ; i++)
            {
                Node node = parent.getChild(i);
                if(node != null && node.toString().contains("soft-page-break"))
                    return true;
            }
        }
        return false;
    }                

Ansgar Konermann

unread,
Jul 12, 2012, 4:53:19 PM7/12/12
to jodrepor...@googlegroups.com
Hi Rashid,

thanks for your report. I'm not sure I fully understand in detail what this is about (an example ODT would be helpful).

There is an issue tracker for JODReports here: https://track.meba.be/issues/JODRP

I suggest you register an account (matter of seconds) and report this as an issue.

Please be so kind and include an example ODT and a screenshot of how the *actual* output looks and how you *expect* it to look.

Thanks in advance

Ansgar Konermann
Reply all
Reply to author
Forward
0 new messages