Bonjour,
on nous demande d'afficher une numérotation de page un peu étrange.
Ainsi, "Page 1 ".x où x vaut le numéro de page du sous-rapport.
Exemple :
Page 1.1
Page 1.2
Page 1.3
Page 1.1
Page 1.2
Le rapport principal est composé comme suit :
Code XML : 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1 --> <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="doc07010702sictaslisting" pageWidth="595" pageHeight="842" columnWidth="550" leftMargin="14" rightMargin="31" topMargin="14" bottomMargin="11" uuid="92d4122f-1f3d-4c50-9ac2-36c9732ca4cf"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="p701-702"/> <property name="net.sf.jasperreports.print.create.bookmarks" value="true"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.*"/> <import value="net.sf.jasperreports.engine.data.*"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression> </parameter> <parameter name="COMMUN_SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression> </parameter> <parameter name="IMAGES_SOURCE_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[]]> </queryString> <field name="lesSic" class="java.util.List"> <fieldDescription><![CDATA[lesSic]]></fieldDescription> </field> <field name="lesTas" class="java.util.List"> <fieldDescription><![CDATA[lesTas]]></fieldDescription> </field> <variable name="subreportValue" class="java.lang.Integer"/> <detail> <band height="77" splitType="Prevent"> <printWhenExpression><![CDATA[$F{lesSic} != null && !$F{lesSic}.isEmpty()]]></printWhenExpression> <subreport> <reportElement x="0" y="0" width="550" height="77" isRemoveLineWhenBlank="true" uuid="3c9a64f5-842f-479e-b18d-120471ccaf25"> <printWhenExpression><![CDATA[$F{lesSic} != null && !$F{lesSic}.isEmpty()]]></printWhenExpression> </reportElement> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="IMAGES_SOURCE_DIR"> <subreportParameterExpression><![CDATA[$P{IMAGES_SOURCE_DIR}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesSic})]]></dataSourceExpression> <returnValue subreportVariable="returnValue" toVariable="subreportValue"/> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "sic.jasper"]]></subreportExpression> </subreport> </band> <band height="77" splitType="Prevent"> <printWhenExpression><![CDATA[$F{lesTas} != null && !$F{lesTas}.isEmpty()]]></printWhenExpression> <subreport> <reportElement x="0" y="0" width="550" height="77" isRemoveLineWhenBlank="true" uuid="c8bc2567-1e73-4e19-aafc-cd233d27fefc"> <printWhenExpression><![CDATA[$F{lesTas} != null && !$F{lesTas}.isEmpty()]]></printWhenExpression> </reportElement> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="IMAGES_SOURCE_DIR"> <subreportParameterExpression><![CDATA[$P{IMAGES_SOURCE_DIR}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesTas})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "tas.jasper"]]></subreportExpression> </subreport> </band> </detail> <pageFooter> <band height="15"> <textField evaluationTime="Master"> <reportElement positionType="FixRelativeToBottom" x="0" y="0" width="550" height="15" uuid="63868fe4-3bbb-4b69-847c-3cd09263e766"/> <textElement textAlignment="Center"> <font fontName="Arial" size="9"/> </textElement> <textFieldExpression><![CDATA["Page 1." +$V{subreportValue}]]></textFieldExpression> </textField> </band> </pageFooter> </jasperReport>
Le premier sous-rapport appelé est composé comme suit :
Code XML : 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140 <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.1 --> <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="sic" pageWidth="595" pageHeight="842" columnWidth="550" leftMargin="14" rightMargin="31" topMargin="14" bottomMargin="11" whenResourceMissingType="Key" uuid="92d4122f-1f3d-4c50-9ac2-36c9732ca4cf"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <property name="net.sf.jasperreports.print.create.bookmarks" value="true"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.*"/> <import value="net.sf.jasperreports.engine.data.*"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression> </parameter> <parameter name="COMMUN_SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression> </parameter> <parameter name="IMAGES_SOURCE_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["./"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[]]> </queryString> <field name="lesHStructure" class="java.util.List"> <fieldDescription><![CDATA[lesHStructure]]></fieldDescription> </field> <field name="lesAdresse" class="java.util.List"> <fieldDescription><![CDATA[lesAdresse]]></fieldDescription> </field> <field name="lesCreances" class="java.util.List"> <fieldDescription><![CDATA[lesCreances]]></fieldDescription> </field> <field name="lesEncadreH" class="java.util.List"> <fieldDescription><![CDATA[lesEncadreH]]></fieldDescription> </field> <field name="lesPtes" class="java.util.List"> <fieldDescription><![CDATA[lesPtes]]></fieldDescription> </field> <variable name="returnValue" class="java.lang.Integer" incrementType="Page"> <initialValueExpression><![CDATA[new Integer ("1")]]></initialValueExpression> </variable> <detail> <band height="68"> <subreport> <reportElement x="0" y="4" width="550" height="64" uuid="00d6c1c0-0038-417d-a85f-7f9c8c39032a"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "logosictas.jasper"]]></subreportExpression> </subreport> <break> <reportElement x="0" y="0" width="550" height="1" uuid="6d7e2368-a66b-4f35-b332-1189b5815938"/> </break> </band> <band height="60"> <subreport> <reportElement x="0" y="0" width="300" height="59" uuid="0874a69b-831b-42ac-a4c7-c54abf7bd17f"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesHStructure})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "hsictas.jasper"]]></subreportExpression> </subreport> <subreport> <reportElement x="300" y="0" width="251" height="60" uuid="90b0d2a6-026c-46f9-a852-e9db67abb514"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesPtes})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "ptesictas.jasper"]]></subreportExpression> </subreport> </band> <band height="50"> <subreport> <reportElement x="0" y="0" width="550" height="50" uuid="e06b6764-1d71-4463-8a14-22f3747a3469"/> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "titresic.jasper"]]></subreportExpression> </subreport> </band> <band height="40"> <subreport> <reportElement x="0" y="0" width="551" height="40" uuid="f02d8ae0-9826-44c4-b24c-e3903d45ac69"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesAdresse})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "adressessictas.jasper"]]></subreportExpression> </subreport> </band> <band height="20"> <subreport> <reportElement x="0" y="0" width="550" height="20" uuid="ff1d98a4-2669-44ef-bc79-659c763af7c0"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesPtes})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "soldepteictas.jasper"]]></subreportExpression> </subreport> </band> <band height="100"> <subreport> <reportElement x="0" y="0" width="550" height="100" uuid="d3bb0eae-8482-4d2c-b992-b742faae8ab8"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesCreances})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "tableaucreances.jasper"]]></subreportExpression> </subreport> </band> <band height="51"> <subreport> <reportElement x="0" y="0" width="550" height="51" uuid="bb2c2549-99b4-40f1-898f-8d101b50190f"/> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($F{lesEncadreH})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "encadrecptlesic.jasper"]]></subreportExpression> </subreport> </band> <band height="51"> <subreport> <reportElement x="0" y="0" width="550" height="50" uuid="3ffb7a5d-111f-4823-8afb-e74894dcf971"/> <subreportParameter name="COMMUN_SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> <subreportExpression><![CDATA[$P{COMMUN_SUBREPORT_DIR} + "baspagesictas.jasper"]]></subreportExpression> </subreport> </band> </detail> </jasperReport>
J'essaie donc de renvoyer au rapport principal le numéro de page du sous-rapport, mais si techniquement j'ai trouvé comment faire, la valeur reste le plus souvent à null.
Auriez-vous des pistes à m'indiquer?
Cordialement,
Thomas
Partager