i have mainreport and subreport , where main report is getting printed in jasper, but not the subreport, see below code for subreport
<jr:list xmlns:jr="http://ift.tt/1cl9b3L" xsi:schemaLocation="http://ift.tt/1cl9b3L http://ift.tt/1cl9b3P" printOrder="Vertical">
<datasetRun subDataset="customerOrderList" uuid="38a2e0f4-ae87-42ad-b3b4-61853d9a2e23">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{customerOrderList})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="39" width="590">
<frame>
<reportElement x="0" y="0" width="590" height="39" uuid="609e3e45-03f6-48d0-8776-e6e393d0dbaf"/>
<subreport>
<reportElement x="0" y="0" width="590" height="39" uuid="d4ef2aed-7826-49e5-9bb1-7642cbd01279"/>
<subreportExpression><![CDATA["src/main/java/com/crafart/reports/customerOrders.jasper"]]></subreportExpression>
</subreport>
</frame>
</jr:listContents>
</jr:list>
i have debugged the code and see there are no issues in generating the report.
i am passing customer order which contains customer details and list of orders. snippet of my customer bean
public class Customer {
private String customerName;
private List<Order> customerOrderList
}
and below code used to generate the report
List<OrderDeclarationBO> orderDeclarationBOLst = new ArrayList<>();
orderDeclarationBOLst.add(orderDeclarationBO);
InputStream in = this.getClass().getResourceAsStream("order.jrxml");
InputStream jasperIn = this.getClass().getResourceAsStream("order.jasper");
JasperCompileManager.compileReport(in);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperIn, new HashMap<String, Object>(), new JRBeanCollectionDataSource(orderDeclarationBOLst));
JasperExportManager.exportReportToPdfFile(jasperPrint, "orderInvoice.pdf");
need help, and dont know what is still required to print subreport.
EDIT :- Adding image of the report, where i am getting null values inside sub report, and not aligned properly
Aucun commentaire:
Enregistrer un commentaire