Rashid Ali
unread,Jul 11, 2012, 3:01:36 PM7/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jodrepor...@googlegroups.com
Hi,
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;
}