質問するログイン新規登録

質問編集履歴

4

XMLを追加

2019/12/24 00:50

投稿

y.kudo
y.kudo

スコア6

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,6 @@
1
1
  以下のサイトを参考にJasperReportsを使用してリストを表示するPDFを作りました。
2
2
 
3
- https://qiita.com/shibafu/items/03444ffd3d847ca159c3
3
+ [SpringMVCとJasperReportsで帳票を印刷してみた](https://qiita.com/shibafu/items/03444ffd3d847ca159c3)
4
4
 
5
5
  ファイル名や変数名以外は、こちらのサイトで記載されているソースを使って作成してみたのですが、
6
6
  フィールドとして定義している箇所にList<Object>の形で値を渡しても同じ場所に列が連なるのではなく、
@@ -29,4 +29,112 @@
29
29
 
30
30
 
31
31
  値の渡し方、または帳票側の設定で誤っている箇所があるのでしょうか。
32
- ご存じの方がいたらご教授お願い致します。
32
+ ご存じの方がいたらご教授お願い致します。
33
+
34
+ ```xml
35
+ <?xml version="1.0" encoding="UTF-8"?>
36
+ <!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
37
+ <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="nedanlist" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="afc2fcf9-928c-427a-ac3f-28e7b63dd8fd">
38
+ <parameter name="companyName" class="java.lang.String"/>
39
+ <queryString>
40
+ <![CDATA[]]>
41
+ </queryString>
42
+ <field name="nedan" class="java.lang.String"/>
43
+ <field name="yasai" class="java.lang.String"/>
44
+ <background>
45
+ <band splitType="Stretch"/>
46
+ </background>
47
+ <title>
48
+ <band height="103" splitType="Stretch">
49
+ <staticText>
50
+ <reportElement x="70" y="-10" width="400" height="60" uuid="5b75924d-dd99-402a-9c4e-c41d99b5339b"/>
51
+ <textElement textAlignment="Center" verticalAlignment="Middle">
52
+ <font fontName="IPAexg" size="22"/>
53
+ </textElement>
54
+ <text><![CDATA[価格表]]></text>
55
+ </staticText>
56
+ </band>
57
+ </title>
58
+ <pageHeader>
59
+ <band height="35" splitType="Stretch"/>
60
+ </pageHeader>
61
+ <columnHeader>
62
+ <band height="61" splitType="Stretch">
63
+ <staticText>
64
+ <reportElement x="280" y="11" width="100" height="30" uuid="046cdbe3-b1ef-4381-88bd-38f4629152d7">
65
+ <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="423e7686-24dc-4f5c-a74d-fdd9c6975af8"/>
66
+ </reportElement>
67
+ <box>
68
+ <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
69
+ <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
70
+ <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
71
+ <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
72
+ </box>
73
+ <textElement>
74
+ <font fontName="IPAexg"/>
75
+ </textElement>
76
+ <text><![CDATA[値段]]></text>
77
+ </staticText>
78
+ <staticText>
79
+ <reportElement x="180" y="11" width="100" height="30" uuid="3255b0d5-b2fc-4faf-b394-4958fbcd6873">
80
+ <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="9a396a1f-2a5c-4bb6-9225-fffb0000200d"/>
81
+ </reportElement>
82
+ <box>
83
+ <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
84
+ <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
85
+ <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
86
+ <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
87
+ </box>
88
+ <textElement>
89
+ <font fontName="IPAexg"/>
90
+ </textElement>
91
+ <text><![CDATA[野菜]]></text>
92
+ </staticText>
93
+ </band>
94
+ </columnHeader>
95
+ <detail>
96
+ <band height="295" splitType="Stretch">
97
+ <textField>
98
+ <reportElement x="280" y="10" width="100" height="10" uuid="4302fbea-0556-4772-9ce3-ea0dba9b3185">
99
+ <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="9a396a1f-2a5c-4bb6-9225-fffb0000200d"/>
100
+ </reportElement>
101
+ <box>
102
+ <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
103
+ <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
104
+ <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
105
+ <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
106
+ </box>
107
+ <textElement>
108
+ <font fontName="IPAexg"/>
109
+ </textElement>
110
+ <textFieldExpression><![CDATA[$F{nedan}]]></textFieldExpression>
111
+ </textField>
112
+ <textField>
113
+ <reportElement x="180" y="10" width="100" height="10" uuid="1002824c-2e87-4b76-b292-78b42f8a15a3">
114
+ <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="423e7686-24dc-4f5c-a74d-fdd9c6975af8"/>
115
+ </reportElement>
116
+ <box>
117
+ <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
118
+ <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
119
+ <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
120
+ <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
121
+ </box>
122
+ <textElement>
123
+ <font fontName="IPAexg"/>
124
+ </textElement>
125
+ <textFieldExpression><![CDATA[$F{yasai}]]></textFieldExpression>
126
+ </textField>
127
+ </band>
128
+ </detail>
129
+ <columnFooter>
130
+ <band height="45" splitType="Stretch"/>
131
+ </columnFooter>
132
+ <pageFooter>
133
+ <band height="54" splitType="Stretch"/>
134
+ </pageFooter>
135
+ <summary>
136
+ <band height="42" splitType="Stretch"/>
137
+ </summary>
138
+ </jasperReport>
139
+
140
+ ```

3

見やすくするための修正

2019/12/24 00:50

投稿

y.kudo
y.kudo

スコア6

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,4 @@
1
- 以下のサイトを参考にJasperReportsを使用してPDFを作りました。
1
+ 以下のサイトを参考にJasperReportsを使用してリストを表示するPDFを作りました。
2
2
 
3
3
  https://qiita.com/shibafu/items/03444ffd3d847ca159c3
4
4
 
@@ -9,24 +9,22 @@
9
9
  値はjava側で設定した値が想定通りでているので、受け渡しはできているようなのですが。。
10
10
 
11
11
 
12
- 想定してた帳票
12
+ --想定してた帳票--
13
-
14
13
  価格表
15
- 野菜|値段
14
+ |野菜|値段|
15
+ |:--|:--:|
16
16
  キャベツ|100
17
17
  レタス|200
18
18
 
19
-
20
- 実際に出力された帳票
19
+ --実際に出力された帳票--
21
-
22
- 1ページ目
20
+ 価格表(1ページ目)
23
- 価格表
24
- 野菜|値段
21
+ |野菜|値段|
22
+ |:--|:--:|
25
23
  キャベツ|100
26
24
 
27
- 2ページ目
25
+ 価格表(2ページ目)
28
- 価格表
29
- 野菜|値段
26
+ |野菜|値段|
27
+ |:--|:--:|
30
28
  レタス|200
31
29
 
32
30
 

2

見た目修正

2019/12/23 08:54

投稿

y.kudo
y.kudo

スコア6

title CHANGED
File without changes
body CHANGED
@@ -10,15 +10,15 @@
10
10
 
11
11
 
12
12
  想定してた帳票
13
- ----------------
13
+
14
14
  価格表
15
15
  野菜|値段
16
16
  キャベツ|100
17
17
  レタス|200
18
- ----------------
19
18
 
19
+
20
20
  実際に出力された帳票
21
- ----------------
21
+
22
22
  1ページ目
23
23
  価格表
24
24
  野菜|値段
@@ -28,7 +28,7 @@
28
28
  価格表
29
29
  野菜|値段
30
30
  レタス|200
31
- ----------------
32
31
 
32
+
33
33
  値の渡し方、または帳票側の設定で誤っている箇所があるのでしょうか。
34
34
  ご存じの方がいたらご教授お願い致します。

1

誤字の修正

2019/12/23 08:40

投稿

y.kudo
y.kudo

スコア6

title CHANGED
File without changes
body CHANGED
@@ -12,22 +12,22 @@
12
12
  想定してた帳票
13
13
  ----------------
14
14
  価格表
15
- |野菜|値段|
15
+ 野菜|値段
16
- |キャベツ|100|
16
+ キャベツ|100
17
- |レタス|200|
17
+ レタス|200
18
18
  ----------------
19
19
 
20
20
  実際に出力された帳票
21
21
  ----------------
22
22
  1ページ目
23
23
  価格表
24
- |野菜|値段|
24
+ 野菜|値段
25
- |キャベツ|100|
25
+ キャベツ|100
26
26
 
27
27
  2ページ目
28
28
  価格表
29
- |野菜|値段|
29
+ 野菜|値段
30
- |レタス|200|
30
+ レタス|200
31
31
  ----------------
32
32
 
33
33
  値の渡し方、または帳票側の設定で誤っている箇所があるのでしょうか。