Skip to content

Commit 18b392c

Browse files
committed
add sample of horizontal and vertical print order
1 parent 5992805 commit 18b392c

19 files changed

+621
-292
lines changed

examples/allelement_subreport.jasper

16 KB
Binary file not shown.

examples/allelements.jasper

59.7 KB
Binary file not shown.

examples/barcodes.jasper

42.9 KB
Binary file not shown.

examples/column_horizontalorder.jrxml

+273
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Created with Jaspersoft Studio version 6.18.1.final using JasperReports Library version 6.18.1-9d75d1969e774d4f179fb3be8401e98a0e6d1611 -->
3+
<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="column_verticalorder" columnCount="3" printOrder="Horizontal" pageWidth="595" pageHeight="842" columnWidth="185" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0f3f9048-2f36-4aca-b5f7-1efe992401c3">
4+
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="postgres"/>
5+
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
6+
<queryString>
7+
<![CDATA[select * from users order by user_id]]>
8+
</queryString>
9+
<field name="created" class="java.sql.Timestamp">
10+
<property name="com.jaspersoft.studio.field.name" value="created"/>
11+
<property name="com.jaspersoft.studio.field.label" value="created"/>
12+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
13+
</field>
14+
<field name="updated" class="java.sql.Timestamp">
15+
<property name="com.jaspersoft.studio.field.name" value="updated"/>
16+
<property name="com.jaspersoft.studio.field.label" value="updated"/>
17+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
18+
</field>
19+
<field name="gender" class="java.lang.String">
20+
<property name="com.jaspersoft.studio.field.name" value="gender"/>
21+
<property name="com.jaspersoft.studio.field.label" value="gender"/>
22+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
23+
</field>
24+
<field name="user_id" class="java.lang.Long">
25+
<property name="com.jaspersoft.studio.field.name" value="user_id"/>
26+
<property name="com.jaspersoft.studio.field.label" value="user_id"/>
27+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
28+
</field>
29+
<field name="fullname" class="java.lang.String">
30+
<property name="com.jaspersoft.studio.field.name" value="fullname"/>
31+
<property name="com.jaspersoft.studio.field.label" value="fullname"/>
32+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
33+
</field>
34+
<field name="email" class="java.lang.String">
35+
<property name="com.jaspersoft.studio.field.name" value="email"/>
36+
<property name="com.jaspersoft.studio.field.label" value="email"/>
37+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
38+
</field>
39+
<field name="description" class="java.lang.String">
40+
<property name="com.jaspersoft.studio.field.name" value="description"/>
41+
<property name="com.jaspersoft.studio.field.label" value="description"/>
42+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
43+
</field>
44+
<field name="createdby" class="java.lang.Long">
45+
<property name="com.jaspersoft.studio.field.name" value="createdby"/>
46+
<property name="com.jaspersoft.studio.field.label" value="createdby"/>
47+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
48+
</field>
49+
<field name="updatedby" class="java.lang.Long">
50+
<property name="com.jaspersoft.studio.field.name" value="updatedby"/>
51+
<property name="com.jaspersoft.studio.field.label" value="updatedby"/>
52+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
53+
</field>
54+
<field name="country_code" class="java.lang.String">
55+
<property name="com.jaspersoft.studio.field.name" value="country_code"/>
56+
<property name="com.jaspersoft.studio.field.label" value="country_code"/>
57+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
58+
</field>
59+
<field name="groupname" class="java.lang.String">
60+
<property name="com.jaspersoft.studio.field.name" value="groupname"/>
61+
<property name="com.jaspersoft.studio.field.label" value="groupname"/>
62+
<property name="com.jaspersoft.studio.field.tree.path" value="users"/>
63+
</field>
64+
<sortField name="user_id"/>
65+
<pageHeader>
66+
<band height="41" splitType="Stretch">
67+
<staticText>
68+
<reportElement x="0" y="0" width="550" height="30" uuid="d7d2f844-ab16-4ce1-b889-4a9862209c06"/>
69+
<box>
70+
<pen lineColor="#039967"/>
71+
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#039967"/>
72+
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
73+
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#039967"/>
74+
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
75+
</box>
76+
<textElement textAlignment="Center" verticalAlignment="Middle">
77+
<font size="18"/>
78+
</textElement>
79+
<text><![CDATA[Horizontal Print Order (3 columns)]]></text>
80+
</staticText>
81+
</band>
82+
</pageHeader>
83+
<columnHeader>
84+
<band height="20" splitType="Stretch">
85+
<property name="com.jaspersoft.studio.layout"/>
86+
<textField>
87+
<reportElement mode="Opaque" x="0" y="0" width="180" height="20" backcolor="#FFF9A1" uuid="aa7f8de8-7d4e-4b1e-adc2-4ed6320720b0"/>
88+
<box>
89+
<pen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
90+
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
91+
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
92+
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
93+
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
94+
</box>
95+
<textFieldExpression><![CDATA["Col Header "+$V{COLUMN_NUMBER}]]></textFieldExpression>
96+
</textField>
97+
</band>
98+
</columnHeader>
99+
<detail>
100+
<band height="154" splitType="Stretch">
101+
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
102+
<frame>
103+
<reportElement x="0" y="0" width="180" height="154" uuid="89922c74-697b-440f-9e76-a45374143e9f"/>
104+
<box>
105+
<pen lineWidth="0.5" lineColor="#A1A1A1"/>
106+
<topPen lineWidth="0.5" lineStyle="Solid" lineColor="#A1A1A1"/>
107+
<leftPen lineWidth="0.5" lineStyle="Solid" lineColor="#A1A1A1"/>
108+
<bottomPen lineWidth="0.5" lineStyle="Solid" lineColor="#A1A1A1"/>
109+
<rightPen lineWidth="0.5" lineStyle="Solid" lineColor="#A1A1A1"/>
110+
</box>
111+
<textField>
112+
<reportElement x="60" y="34" width="120" height="30" uuid="5ec97c1f-20dd-4300-8faa-afd13228a868">
113+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="74ef20f6-ee01-45a5-9b79-11b2fb7b5edb"/>
114+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
115+
</reportElement>
116+
<textElement verticalAlignment="Middle"/>
117+
<textFieldExpression><![CDATA[$F{fullname}]]></textFieldExpression>
118+
</textField>
119+
<textField>
120+
<reportElement x="60" y="64" width="120" height="30" uuid="eeafa30e-ddcd-47f4-8d87-683da3a6a856">
121+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="1e52ece0-84df-4ea3-b068-1cf634a4db2f"/>
122+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
123+
</reportElement>
124+
<textElement verticalAlignment="Middle"/>
125+
<textFieldExpression><![CDATA[$F{email}]]></textFieldExpression>
126+
</textField>
127+
<textField>
128+
<reportElement x="60" y="94" width="120" height="30" uuid="c6964c31-ca32-4db4-8b94-608b0867e873">
129+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="27ef6a3f-84d9-4f80-b03f-2403f3ecf5e5"/>
130+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
131+
</reportElement>
132+
<textElement verticalAlignment="Middle"/>
133+
<textFieldExpression><![CDATA[$F{gender}]]></textFieldExpression>
134+
</textField>
135+
<staticText>
136+
<reportElement x="0" y="124" width="60" height="30" uuid="af7b3ae0-10ea-4de2-9076-c946ecf2296e">
137+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="02918749-9965-4d3b-afa7-ed3f8158db91"/>
138+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
139+
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
140+
</reportElement>
141+
<textElement verticalAlignment="Middle">
142+
<font isBold="true"/>
143+
<paragraph leftIndent="5"/>
144+
</textElement>
145+
<text><![CDATA[Country :]]></text>
146+
</staticText>
147+
<staticText>
148+
<reportElement x="0" y="34" width="60" height="30" uuid="8d25bb55-151c-4d3c-9faf-ae8a24170077">
149+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="74ef20f6-ee01-45a5-9b79-11b2fb7b5edb"/>
150+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
151+
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
152+
</reportElement>
153+
<textElement verticalAlignment="Middle">
154+
<font isBold="true"/>
155+
<paragraph leftIndent="5"/>
156+
</textElement>
157+
<text><![CDATA[Name :]]></text>
158+
</staticText>
159+
<staticText>
160+
<reportElement x="0" y="94" width="60" height="30" uuid="01f81de0-c304-4b00-ab7a-2afb5418061b">
161+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="27ef6a3f-84d9-4f80-b03f-2403f3ecf5e5"/>
162+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
163+
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
164+
</reportElement>
165+
<textElement verticalAlignment="Middle">
166+
<font isBold="true"/>
167+
<paragraph leftIndent="5"/>
168+
</textElement>
169+
<text><![CDATA[Gender :]]></text>
170+
</staticText>
171+
<staticText>
172+
<reportElement x="0" y="64" width="60" height="30" uuid="38e3876a-968f-4b9a-b901-a28a12c12db6">
173+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="1e52ece0-84df-4ea3-b068-1cf634a4db2f"/>
174+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
175+
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
176+
</reportElement>
177+
<textElement verticalAlignment="Middle">
178+
<font isBold="true"/>
179+
<paragraph leftIndent="5"/>
180+
</textElement>
181+
<text><![CDATA[Email :]]></text>
182+
</staticText>
183+
<textField>
184+
<reportElement x="60" y="124" width="120" height="30" uuid="e0945f0a-c99a-418b-9d03-c702c27b04b3">
185+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="02918749-9965-4d3b-afa7-ed3f8158db91"/>
186+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
187+
</reportElement>
188+
<textElement verticalAlignment="Middle"/>
189+
<textFieldExpression><![CDATA[$F{country_code}]]></textFieldExpression>
190+
</textField>
191+
<textField>
192+
<reportElement x="61" y="4" width="119" height="30" uuid="c8a6e665-83a5-42bc-aa52-7647ba476fff">
193+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="4a6a8cef-122b-4469-8ece-f4bd85c2b7d8"/>
194+
</reportElement>
195+
<textElement verticalAlignment="Middle"/>
196+
<textFieldExpression><![CDATA[$F{user_id}]]></textFieldExpression>
197+
</textField>
198+
<staticText>
199+
<reportElement x="0" y="4" width="60" height="30" uuid="f5187bc6-d05d-481f-8617-724a031e316e">
200+
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="74ef20f6-ee01-45a5-9b79-11b2fb7b5edb"/>
201+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
202+
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
203+
</reportElement>
204+
<textElement verticalAlignment="Middle">
205+
<font isBold="true"/>
206+
<paragraph leftIndent="5"/>
207+
</textElement>
208+
<text><![CDATA[ID :]]></text>
209+
</staticText>
210+
</frame>
211+
</band>
212+
</detail>
213+
<columnFooter>
214+
<band height="26" splitType="Stretch">
215+
<textField>
216+
<reportElement mode="Opaque" x="0" y="0" width="180" height="20" backcolor="#FFF9A1" uuid="55857606-a2a1-472b-88d7-7924c8358262"/>
217+
<box>
218+
<pen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
219+
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
220+
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
221+
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
222+
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#999999"/>
223+
</box>
224+
<textFieldExpression><![CDATA["Col Footer "+$V{COLUMN_NUMBER}]]></textFieldExpression>
225+
</textField>
226+
</band>
227+
</columnFooter>
228+
<pageFooter>
229+
<band height="54" splitType="Stretch">
230+
<textField>
231+
<reportElement x="180" y="0" width="100" height="30" uuid="bc7ac1cb-50d7-416f-a33b-d920b7554290"/>
232+
<textElement textAlignment="Right"/>
233+
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
234+
</textField>
235+
<textField evaluationTime="Report">
236+
<reportElement x="280" y="0" width="100" height="30" uuid="215297b2-0537-48fc-83da-f4983009a64d"/>
237+
<textElement textAlignment="Left"/>
238+
<textFieldExpression><![CDATA[" of " + $V{PAGE_NUMBER}]]></textFieldExpression>
239+
</textField>
240+
<line>
241+
<reportElement x="0" y="0" width="560" height="1" uuid="0187a63d-bc34-444c-b2c4-d01cc3b062c8"/>
242+
<graphicElement>
243+
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#8A8A8A"/>
244+
</graphicElement>
245+
</line>
246+
</band>
247+
</pageFooter>
248+
<summary>
249+
<band height="40" splitType="Stretch">
250+
<staticText>
251+
<reportElement x="0" y="0" width="210" height="20" uuid="741d7bcf-37b7-40ec-85fd-ff703dad69a1"/>
252+
<textElement>
253+
<font isBold="true"/>
254+
</textElement>
255+
<text><![CDATA[Summary :]]></text>
256+
</staticText>
257+
<staticText>
258+
<reportElement x="0" y="20" width="60" height="20" uuid="ed99e5a1-794b-4edf-ad0c-38ac1f29b741"/>
259+
<text><![CDATA[Total:]]></text>
260+
</staticText>
261+
<textField>
262+
<reportElement x="60" y="20" width="150" height="20" uuid="df684c19-0ab5-40ae-9c2a-4125e34567ae"/>
263+
<box topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="5"/>
264+
<textElement textAlignment="Right"/>
265+
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
266+
</textField>
267+
<staticText>
268+
<reportElement x="210" y="20" width="60" height="20" uuid="52c1e491-aa84-4733-b5c7-3e5c8bc1f092"/>
269+
<text><![CDATA[Person(s)]]></text>
270+
</staticText>
271+
</band>
272+
</summary>
273+
</jasperReport>

examples/column_horizontalorder.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
include "main.php";
3+
4+
use simitsdk\phpjasperxml\PHPJasperXML;
5+
$filename = __DIR__.'/column_horizontalorder.jrxml';
6+
7+
$data = [];
8+
$faker = Faker\Factory::create('en_US');
9+
for($i=0;$i<25;$i++)
10+
{
11+
$tmp=[
12+
'fullname' => $faker->name(),
13+
'email' => $faker->email(),
14+
'gender' => $faker->randomElement(['M', 'F']),
15+
'user_id'=> $i+10000,
16+
'description'=>"Begin $i.\n".$faker->realText(70)."\n".$faker->realText() ."\n Ending",
17+
'country_code'=>$faker->randomElement(['SG','AU','US','MY']),
18+
'created'=>$faker->date("Y-m-d H:i:s")
19+
20+
];
21+
$data[$i]=$tmp;
22+
}
23+
24+
25+
$config = ['driver'=>'hasharray','data'=>$data];
26+
27+
$report = new PHPJasperXML();
28+
$report->load_xml_file($filename)
29+
->setDataSource($config)
30+
->export('Pdf');
31+

examples/column_verticalorder.jasper

23.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)