Through various searches on the internet I found how to use the HtmlComponent in my project to have an HTML-table in my report (as an image).
However, I can't seem to find how I can add the HtmlComponent to a JasperDesign.
Versions in use:
- Jasper 5.6.1
- HtmlComponent 5.0.1 (derived from iReport 5.6.0).
My current code:
HtmlComponent table = new HtmlComponent(); JRDesignExpression expression = new JRDesignExpression(); expression.setText(html.replace("\n", "")); table.setHtmlContentExpression(expression); JRDesignGroup group = new JRDesignGroup(); group.setName(TABLE_GROUP_PREFIX); JRDesignBand groupHeader = new JRDesignBand(); groupHeader.setHeight(200); groupHeader.setSplitType(SplitTypeEnum.IMMEDIATE); groupHeader.addElement(table); ((JRDesignSection) group.getGroupHeaderSection()).addBand(groupHeader); return jasperDesign;
Obviously, groupHeader.addElement(table) doesn't work since table is not an element but a component.
Anyone and idea?
3 Answers:
Since I wasn't expecting as much action here as on StackOverflow, I posed my question there as well. The answer to my problem is written there:
http://stackoverflow.com/questions/42560528/how-to-add-the-htmlcomponent...
hozawa, is that supported through jasper 5.6.1?
EDIT: I found something interesting here: http://community.jaspersoft.com/wiki/custom-visualization-component-jasp...
I am not sure however if it will be usable.