在主数据源中,我有一个字段“ List someDto”。而且我需要将此字段添加到子报表数据源。也许我可以使用一些表达式,该表达式将返回JRDataSource类型?
report.addDetail(subreport(report()
.addDetail(text(field("text", String.class)))
.addDetail(image(fieldExpression("image")))
.setDataSource(----*here i need to add field from main datasource*----)
答案 0 :(得分:0)
天哪,我只是使用subDatasourceBeanCollection并将.setDataSource从report()。setDataSource替换为subreport(...)。setDataSource():
report.addDetail(subreport(report()
.addDetail(text(field("text", String.class)))
.addDetail(image(fieldExpression("image"))))
.setDataSource(subDatasourceBeanCollection("*here my field from main datasource")));