我想在我的賈斯珀報告中創建一個表。 這可以在iReport中完成(這是完成的:-)),但表的內容(例如列的名稱)正在改變,所以我想創建僅從JAVA代碼(通過不使用jrxml文件)。賈斯珀報告表創建
這怎麼可能?
到目前爲止,這是我做了什麼(主要僅限零件):
//table component
final StandardTable table = new StandardTable();
final StandardColumn col1 = new StandardColumn();
final DesignCell col1Header = new DesignCell();
final JRDesignStaticText textElement = new JRDesignStaticText();
col1Header.addElement(textElement);
col1.setDetailCell(col1Header);
table.addColumn(col1);
/datasource
final JRDesignDatasetParameter param = new JRDesignDatasetParameter();
param.setName("REPORT_DATA_SOURCE");
final JRDesignExpression exp = new JRDesignExpression("$P{REPORT_DATA_SOURCE}");
param.setExpression(exp);
//datasetrun
final JRDesignDatasetRun drs = new JRDesignDatasetRun();
table.setDatasetRun(drs);
drs.addParameter(param);
如何繼續?
謝謝 krisy
請問您爲什麼使用「jr」? 我創建HtmlComponent,它與我需要創建componentKey的相同。我得到以下錯誤'沒有找到名稱爲htmlComponent的組件管理器,命名空間爲http:// jasperreports.sourceforge.net/htmlcomponent' – michdraft 2014-04-03 14:23:49