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.