Bonjour, décidemment j'ai des problèmes avec les sous-rapport
Voici un rapport avec 2 sous-rapport, les 2 sous rapport étant dans un groupe
Quand je rempli le rapport de la manière suivante
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="crf" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="SIMPLE_DATA" class="java.util.HashMap"> </parameter> <field name="subreport2" class="java.util.HashMap"/> <field name="subReportName" class="java.lang.String"/> <field name="subReportDataSource" class="net.sf.jasperreports.engine.data.JRMapCollectionDataSource"/> <field name="subReportJasperReport" class="net.sf.jasperreports.engine.JasperReport"/> <group name="Group1" > <groupExpression><![CDATA[$F{subReportName}]]></groupExpression> <groupHeader> <band height="792"> <subreport> <reportElement positionType="Float" x="0" y="0" width="555" height="792"/> <subreportParameter name="subReportName"> <subreportParameterExpression><![CDATA[$F{subReportName}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[$F{subReportDataSource}]]></dataSourceExpression> <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$F{subReportJasperReport}]]></subreportExpression> </subreport> <subreport> <reportElement positionType="Float" x="0" y="0" width="595" height="792"/> <subreportParameter name="subReportName"> <subreportParameterExpression><![CDATA[$F{subReportName}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[$F{subreport2}.get("subReportDataSource")]]></dataSourceExpression> <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$F{subreport2}.get("subReportJasperReport")]]></subreportExpression> </subreport> </band> </groupHeader> </group> <background> <band splitType="Stretch"/> </background> <title> <band height="0" splitType="Stretch"/> </title> <columnHeader> <band height="0" splitType="Stretch"/> </columnHeader> <detail> </detail> <columnFooter> <band height="0" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="30" splitType="Stretch"> <frame> <reportElement mode="Opaque" x="2" y="0" width="553" height="30" forecolor="#D0B48E" backcolor="#F2EBDF"/> <textField> <reportElement x="224" y="3" width="39" height="20"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA[$V{PAGE_NUMBER}+"/"]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="264" y="3" width="40" height="20"/> <textElement/> <textFieldExpression><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> </frame> </band> </pageFooter> <summary> <band height="0" splitType="Stretch"/> </summary> </jasperReport>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 Map simpleMasterMap = new HashMap(); Map subreport2 = new HashMap(); subreport2.put("subReportJasperReport", subReportQueryJasperReportList.get(1)); subreport2.put("subReportDataSource", subReportQueryDataSourceList.get(1)); simpleMasterMap.put("subReportName", subReportName.get(1)); simpleMasterMap.put("subReportJasperReport", subReportJasperReport.get(1)); simpleMasterMap.put("subReportDataSource", subReportDataSource.get(1)); simpleMasterMap.put("subreport2", subreport2); simpleMasterList.add(simpleMasterMap); JRDataSource simpleDS = new JRMapCollectionDataSource(simpleMasterList); HashMap SIMPLE_DATA = new HashMap(); params.put("SIMPLE_DATA", SIMPLE_DATA); JasperPrint jasperPrint = null; InputStream jrxmlInputStream = new ByteArrayInputStream(jrxml.toString().getBytes()); if (simpleDS == null) simpleDS = new JREmptyDataSource(1); try { JasperDesign jasperDesign = JRXmlLoader.load(jrxmlInputStream); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); jasperPrint = JasperFillManager.fillReport(jasperReport, params, simpleDS);
il tourne de manière infini avec les output suivant
Merci d'avance pour vos réponses
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 2012-05-20 10:16:27 JRVerticalFiller [DEBUG] Fill 2: page header 2012-05-20 10:16:27 JRVerticalFiller [DEBUG] Fill 2: page header 2012-05-20 10:16:27 JRBaseFiller [DEBUG] Fill 2: suspeding subreport runner 2012-05-20 10:16:27 JRBaseFiller [DEBUG] Fill 2: suspeding subreport runner 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notifying on suspend 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notifying on suspend 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: waiting to continue 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: waiting to continue 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notified of fill result 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notified of fill result 2012-05-20 10:16:27 JRFillSubreport [DEBUG] Fill 1: subreport 2 to continue 2012-05-20 10:16:27 JRFillSubreport [DEBUG] Fill 1: subreport 2 to continue 2012-05-20 10:16:27 JRVerticalFiller [DEBUG] Fill 1: page footer 2012-05-20 10:16:27 JRVerticalFiller [DEBUG] Fill 1: page footer 2012-05-20 10:16:27 JRBaseFiller [DEBUG] Adding evaluation of net.sf.jasperreports.engine.fill.JRTemplatePrintText@4b939fbd by net.sf.jasperreports.engine.fill.JRFillTextField@49b9b979 for evaluation {type: REPORT, group: null, band: 0} 2012-05-20 10:16:27 JRBaseFiller [DEBUG] Adding evaluation of net.sf.jasperreports.engine.fill.JRTemplatePrintText@4b939fbd by net.sf.jasperreports.engine.fill.JRFillTextField@49b9b979 for evaluation {type: REPORT, group: null, band: 0} 2012-05-20 10:16:27 JRBaseFiller [DEBUG] Fill 1: adding page 5394 2012-05-20 10:16:27 JRBaseFiller [DEBUG] Fill 1: adding page 5394 2012-05-20 10:16:27 JRFillSubreport [DEBUG] Fill 1: resuming 2 2012-05-20 10:16:27 JRFillSubreport [DEBUG] Fill 1: resuming 2 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notifying to continue 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notifying to continue 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: waiting for fill result 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: waiting for fill result 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notified to continue 2012-05-20 10:16:27 JRThreadSubreportRunner [DEBUG] Fill 2: notified to continue
Partager