我在 Java 中将数据源添加到我的 Jasper Report 的子报表时遇到问题
I have the problem with adding datasource to the subreport of my Jasper Report in Java
在主数据源中我有一个字段 "List someDto"。我需要将此字段添加到子报表数据源。也许我可以使用一些表达式,将 return 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*----)
Omg,我只是使用 subDatasourceBeanCollection 并将 report().setDataSource 中的 .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")));
在主数据源中我有一个字段 "List someDto"。我需要将此字段添加到子报表数据源。也许我可以使用一些表达式,将 return 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*----)
Omg,我只是使用 subDatasourceBeanCollection 并将 report().setDataSource 中的 .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")));