Pentaho报告引擎 - 如何在子报告中使用ItemBand

时间:2017-02-09 09:07:54

标签: reporting-services pentaho

如何使用Pentaho Reporting Engine对子报表中的ItemBand进行编码?

我已将我的ItemBand定义如下:

ItemBand rowBand = new ItemBand();
TextFieldElementFactory textFactory3 = new TextFieldElementFactory();
textFactory3.setFieldname("reportname");
Element element = textFactory3.createElement();
element.setDynamicContent(true);
rowBand.addElement(element);
itemBand2.addElement(rowBand);

现在如何在子报表中使用ItemBand?

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

谢谢,

我能够做到:

RelationalGroup subgroup = new RelationalGroup();
GroupDataBody subgroupData = new GroupDataBody();
ItemBand itemBand = new ItemBand();
itemBand.setVisible(true);
subgroupData.setItemBand(itemBand);
subgroup.setBody(subgroupData);
subReport.setRootGroup(subgroup);

ItemBand rowBand = new ItemBand();
rowBand.setLayout(BandStyleKeys.LAYOUT_ROW);

TextFieldElementFactory subtext = new TextFieldElementFactory();
subtext.setFieldname("reportname");
subtext.setX(new Float(12.0));
subtext.setMinimumWidth(new Float(100.0));
subtext.setHeight(new Float(20.0));
Element subelement = subtext.createElement();
subelement.setDynamicContent(true);
rowBand.addElement(subelement);

TextFieldElementFactory subtext2 = new TextFieldElementFactory();
subtext2.setFieldname("reportheader");
subtext2.setX(new Float(112.0));
subtext2.setMinimumWidth(new Float(100.0));
subtext2.setHeight(new Float(20.0));
Element subelement2 = subtext2.createElement();
subelement2.setDynamicContent(true);
rowBand.addElement(subelement2);

itemBand.addElement(rowBand);

report.getReportFooter().addSubReport(subReport);