Java code for creating Pentaho reports and this reports accept input as data integration(.ktr) file

南笙酒味 提交于 2020-01-07 04:57:13

问题


I am looking for java code in which have to display Pentaho reports in HTML/PDF format with Data Integration(.ktr file) as input to the Pentaho reports.


回答1:


First of all most probably there is official documentation to API, chapter "Embedding the Reporting Engine Into a Java Application"

Code it pretty simple

Create report using visual tool, assign data source as .ktr file, and code as example in tutorial.

Only u might need to customize path to *.ktr file which either can be made via official API (most probably) or prepare report *.prpt before to start report.

Pentaho Report Designer generate files with prpt extension which is just a zip file with a lot of xml files inside. So u need to unpack it (java.util.zip) and inside in folder datasources file kettle-ds.xml. Use any suitable xml parser to change path to *.ktr file and pack it back. Then pass customized report to report engine.



来源:https://stackoverflow.com/questions/32474437/java-code-for-creating-pentaho-reports-and-this-reports-accept-input-as-data-int

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!