我想在我的贾斯珀报告中创建一个表。 这可以在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