Skip to content

Commit b856b81

Browse files
committed
prepare some examples
1 parent aed6da7 commit b856b81

18 files changed

+1045
-565
lines changed

examples/allelement_subreport.jasper

14.8 KB
Binary file not shown.

examples/allelement_subreport.jrxml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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="allelement_subreport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0679965e-8be3-4031-91da-75d7e2b42350">
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 1 as a]]>
8+
</queryString>
9+
<field name="a" class="java.lang.Integer">
10+
<property name="com.jaspersoft.studio.field.name" value="a"/>
11+
<property name="com.jaspersoft.studio.field.label" value="a"/>
12+
</field>
13+
<detail>
14+
<band height="125" splitType="Stretch"/>
15+
</detail>
16+
<noData>
17+
<band height="130">
18+
<rectangle>
19+
<reportElement mode="Opaque" x="0" y="5" width="200" height="95" backcolor="#FFEE05" uuid="f1a3ef96-a07c-4140-bffc-4b89da671ff6"/>
20+
</rectangle>
21+
<textField>
22+
<reportElement mode="Opaque" x="15" y="20" width="170" height="65" backcolor="#05FF2B" uuid="4ad6001c-8253-4470-96cf-66033848dce1"/>
23+
<textElement textAlignment="Center">
24+
<font size="14" isBold="true"/>
25+
</textElement>
26+
<textFieldExpression><![CDATA["This is subreport"]]></textFieldExpression>
27+
</textField>
28+
<staticText>
29+
<reportElement x="30" y="50" width="150" height="30" uuid="4094ed64-418c-431d-ac08-4756e9184c9e"/>
30+
<text><![CDATA[Using no data band]]></text>
31+
</staticText>
32+
</band>
33+
</noData>
34+
</jasperReport>

examples/allelements.jrxml

+496
Large diffs are not rendered by default.

examples/allelements.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
include "main.php";
3+
use Simitsdk\phpjasperxml\PHPJasperXML;
4+
$filename = __DIR__.'/allelements.jrxml';
5+
6+
$data=[];
7+
8+
$config = ['driver'=>'dummy','data'=>$data];
9+
10+
$report = new PHPJasperXML();
11+
$report->load_xml_file($filename)
12+
->setParameter(['subreportconnection'=>$config ])
13+
->setDataSource($config)
14+
->export('Pdf');
15+

examples/barcodes.jrxml

+98-129
Large diffs are not rendered by default.

examples/barcodes.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
include "main.php";
3+
use Simitsdk\phpjasperxml\PHPJasperXML;
4+
$filename = __DIR__.'/barcodes.jrxml';
5+
6+
$data=[
7+
['a'=>1]
8+
]; // 1 row
9+
10+
$config = ['driver'=>'dummy','data'=>$data];
11+
$report = new PHPJasperXML();
12+
$report->load_xml_file($filename)
13+
->setDataSource($config)
14+
->export('Pdf');
15+

examples/formating.jrxml

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
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="formating" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f2db0891-8bf1-476d-a9e8-abaddc3ba818">
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 global_user]]>
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="global_user"/>
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="global_user"/>
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="global_user"/>
23+
</field>
24+
<field name="globaluser_id" class="java.lang.Long">
25+
<property name="com.jaspersoft.studio.field.name" value="globaluser_id"/>
26+
<property name="com.jaspersoft.studio.field.label" value="globaluser_id"/>
27+
<property name="com.jaspersoft.studio.field.tree.path" value="global_user"/>
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="global_user"/>
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="global_user"/>
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="global_user"/>
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="global_user"/>
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="global_user"/>
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="global_user"/>
58+
</field>
59+
<detail>
60+
<band height="30" splitType="Stretch">
61+
<textField>
62+
<reportElement x="0" y="0" width="180" height="30" uuid="a1d90150-cd7d-446f-bd22-6a236142dc58"/>
63+
<textElement textAlignment="Right">
64+
<font size="12" isBold="true"/>
65+
</textElement>
66+
<textFieldExpression><![CDATA[$F{fullname}]]></textFieldExpression>
67+
</textField>
68+
<textField>
69+
<reportElement x="180" y="0" width="237" height="30" uuid="869233f9-a2a7-4cff-aed9-e3cd95ea4dba"/>
70+
<textElement textAlignment="Center">
71+
<font fontName="Courier" isBold="false" isItalic="true" isUnderline="true"/>
72+
</textElement>
73+
<textFieldExpression><![CDATA[$F{email}]]></textFieldExpression>
74+
</textField>
75+
</band>
76+
<band height="124">
77+
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
78+
<textField>
79+
<reportElement mode="Opaque" x="0" y="0" width="141" height="124" backcolor="#E6FF05" uuid="8a90a4de-b55c-46cd-a546-71954ee5b2cf"/>
80+
<box>
81+
<pen lineWidth="2.0" lineColor="#2205FF"/>
82+
<topPen lineWidth="2.0" lineStyle="Solid" lineColor="#2205FF"/>
83+
<leftPen lineWidth="2.0" lineStyle="Solid" lineColor="#2205FF"/>
84+
<bottomPen lineWidth="2.0" lineStyle="Solid" lineColor="#2205FF"/>
85+
<rightPen lineWidth="2.0" lineStyle="Solid" lineColor="#2205FF"/>
86+
</box>
87+
<textElement>
88+
<font isUnderline="true"/>
89+
</textElement>
90+
<textFieldExpression><![CDATA[$F{description}+$F{description}]]></textFieldExpression>
91+
</textField>
92+
<textField>
93+
<reportElement mode="Opaque" x="141" y="0" width="138" height="124" backcolor="#A6FFB6" uuid="7d3b6a51-7bda-403d-86bf-7b870ee6a9e9"/>
94+
<box>
95+
<pen lineWidth="3.75" lineStyle="Solid"/>
96+
<topPen lineWidth="2.75" lineStyle="Solid" lineColor="#FA232A"/>
97+
<leftPen lineWidth="2.25" lineStyle="Solid" lineColor="#000000"/>
98+
<bottomPen lineWidth="2.25" lineStyle="Solid" lineColor="#FA0FD7"/>
99+
<rightPen lineWidth="2.5" lineStyle="Solid" lineColor="#0F1BFA"/>
100+
</box>
101+
<textElement textAlignment="Right" rotation="Left">
102+
<font isUnderline="false" isStrikeThrough="true"/>
103+
</textElement>
104+
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
105+
</textField>
106+
<textField>
107+
<reportElement mode="Opaque" x="279" y="0" width="138" height="124" backcolor="#FF99FD" uuid="5ea1f238-24ca-49e7-89e0-48884e9e8d30"/>
108+
<box>
109+
<pen lineWidth="1.75" lineStyle="Dotted"/>
110+
<topPen lineWidth="4.0" lineStyle="Solid" lineColor="#0505FF"/>
111+
<leftPen lineWidth="3.5" lineStyle="Dotted" lineColor="#F54505"/>
112+
<bottomPen lineWidth="2.25" lineStyle="Dashed" lineColor="#0505FF"/>
113+
<rightPen lineWidth="3.0" lineStyle="Dotted" lineColor="#2BFF05"/>
114+
</box>
115+
<textElement textAlignment="Justified" rotation="Right">
116+
<font isUnderline="false"/>
117+
</textElement>
118+
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
119+
</textField>
120+
<textField>
121+
<reportElement mode="Opaque" x="417" y="0" width="138" height="124" backcolor="#52FFFF" uuid="78f3963f-fcc6-4a7b-a36d-e8329198770d"/>
122+
<box>
123+
<pen lineWidth="3.75" lineStyle="Solid"/>
124+
<topPen lineWidth="2.75" lineStyle="Dotted" lineColor="#FA232A"/>
125+
<leftPen lineWidth="2.25" lineStyle="Solid" lineColor="#000000"/>
126+
<bottomPen lineWidth="2.5" lineStyle="Double" lineColor="#FA0FD7"/>
127+
<rightPen lineWidth="2.5" lineStyle="Dashed" lineColor="#0F1BFA"/>
128+
</box>
129+
<textElement textAlignment="Center" rotation="UpsideDown">
130+
<font fontName="Times" isItalic="true"/>
131+
</textElement>
132+
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
133+
</textField>
134+
</band>
135+
<band height="153">
136+
<frame>
137+
<reportElement mode="Transparent" x="20" y="13" width="140" height="140" uuid="52826fdc-9204-4bbb-a6bc-67d224b6a6fa">
138+
<property name="com.jaspersoft.studio.unit.x" value="px"/>
139+
</reportElement>
140+
<ellipse>
141+
<reportElement mode="Opaque" x="0" y="10" width="130" height="125" backcolor="#FA0522" uuid="a2f021dc-80e7-4610-866b-dd52fcaaf3ad"/>
142+
<graphicElement>
143+
<pen lineWidth="7.0" lineStyle="Solid" lineColor="#ECFC0D"/>
144+
</graphicElement>
145+
</ellipse>
146+
<ellipse>
147+
<reportElement mode="Opaque" x="20" y="30" width="90" height="80" forecolor="#030303" backcolor="#0DFC41" uuid="69408f2e-2756-407a-99e7-8f1c08241dd6"/>
148+
<graphicElement>
149+
<pen lineWidth="5.0" lineStyle="Dashed" lineColor="#1134FA"/>
150+
</graphicElement>
151+
</ellipse>
152+
<ellipse>
153+
<reportElement x="44" y="50" width="40" height="40" uuid="406d5d27-df28-4474-a931-9e0fe293aba7"/>
154+
</ellipse>
155+
</frame>
156+
<rectangle radius="0">
157+
<reportElement mode="Opaque" x="210" y="20" width="100" height="50" backcolor="#FCE405" uuid="33106a8d-b90f-49c9-aef6-dc9e51fd871c"/>
158+
<graphicElement>
159+
<pen lineWidth="3.0" lineColor="#F70AFF"/>
160+
</graphicElement>
161+
</rectangle>
162+
<rectangle radius="0">
163+
<reportElement mode="Transparent" x="290" y="30" width="100" height="50" uuid="9b45f9f7-f739-4590-8bf4-c8a3a454242a"/>
164+
<graphicElement>
165+
<pen lineWidth="2.0" lineStyle="Dashed" lineColor="#0D25FF"/>
166+
</graphicElement>
167+
</rectangle>
168+
<rectangle radius="10">
169+
<reportElement x="350" y="58" width="100" height="50" backcolor="#C4B9FA" uuid="8e339fd5-d17f-46f0-b95e-903bed476f31"/>
170+
<graphicElement>
171+
<pen lineWidth="7.0" lineStyle="Dotted" lineColor="#E6514E"/>
172+
</graphicElement>
173+
</rectangle>
174+
<staticText>
175+
<reportElement x="360" y="60" width="79" height="40" forecolor="#FF0516" uuid="99768b41-2e52-4877-9aa2-8c2251c7027d"/>
176+
<textElement>
177+
<font isBold="true"/>
178+
</textElement>
179+
<text><![CDATA[line style wrong due to upstream bugs]]></text>
180+
</staticText>
181+
</band>
182+
<band height="55">
183+
<line>
184+
<reportElement x="30" y="0" width="111" height="50" uuid="b52553a0-1471-4491-af51-aaad7ac1960f"/>
185+
</line>
186+
<line>
187+
<reportElement x="160" y="0" width="160" height="50" uuid="c34ef847-adfd-40a5-a608-81b7dec38995"/>
188+
<graphicElement>
189+
<pen lineWidth="5.0" lineStyle="Dashed" lineColor="#0532FA"/>
190+
</graphicElement>
191+
</line>
192+
<line>
193+
<reportElement x="350" y="2" width="160" height="50" uuid="2bc911b0-c3cb-47ff-b41f-617264ce88b8"/>
194+
<graphicElement>
195+
<pen lineWidth="2.0" lineStyle="Dotted" lineColor="#FF051E"/>
196+
</graphicElement>
197+
</line>
198+
</band>
199+
</detail>
200+
</jasperReport>

examples/example1.php renamed to examples/formating.php

+4-13
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22
include "main.php";
33

44
use Simitsdk\phpjasperxml\PHPJasperXML;
5-
$filename = __DIR__.'/example1.jrxml';
6-
// $filename = __DIR__.'/multicolumn-vertical.jrxml';
7-
// $filename = __DIR__.'/multicolumn-horizontal.jrxml';
8-
// $filename = __DIR__.'/multipleelements.jrxml';
9-
$filename = __DIR__.'/letter.jrxml';
10-
// $filename = __DIR__.'/barcodes.jrxml';
11-
// $filename = __DIR__.'/statement.jrxml';
12-
// $filename = __DIR__.'/uat.jrxml';
5+
$filename = __DIR__.'/formating.jrxml';
136

147
function getS3($a)
158
{
@@ -18,7 +11,7 @@ function getS3($a)
1811

1912
$data = [];
2013
$faker = Faker\Factory::create('en_US');
21-
for($i=0;$i<40;$i++)
14+
for($i=0;$i<10;$i++)
2215
{
2316
$tmp=[
2417
'fullname' => $faker->name(),
@@ -34,7 +27,6 @@ function getS3($a)
3427
}
3528

3629

37-
$configsubreport = ['driver'=>'postgresql','host'=>'127.0.0.1','user'=>'postgres','pass'=>'postgres','name'=>'backend']; //postgresql db
3830
$config = ['driver'=>'dummy','data'=>$data];
3931

4032
$pdffilename = '/tmp/sample1.pdf';
@@ -44,8 +36,7 @@ function getS3($a)
4436
}
4537

4638
$report = new PHPJasperXML();
47-
$report->load_xml_file($filename)
48-
->setParameter(['subreportconnection'=>$configsubreport])
39+
$report->load_xml_file($filename)
4940
->setDataSource($config)
50-
->export('Pdf',$pdffilename);
41+
->export('Pdf');
5142

Binary file not shown.

examples/images/simit.png

35.5 KB
Loading

examples/index.html

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<html>
2+
<head>
3+
<title>PHPJasperxml samples</title>
4+
<script>
5+
function changeformat(){
6+
let formatvalue = document.getElementById('selectFormat').value;
7+
document.getElementById("iframereport").src=formatvalue;
8+
}
9+
10+
</script>
11+
</head>
12+
<body>
13+
<label> Select Examples
14+
<select id="selectFormat" onchange="changeformat()">
15+
<option value="">None</option>
16+
<option value="allelements.php">All Elements (Support & Not Supported)</option>
17+
<option value="barcodes.php">Barcodes</option>
18+
<option value="formating.php">Elements Format Setting</option>
19+
<!-- <option value="example1.php">Sub Report</option> -->
20+
21+
<!-- <option value="example1.php">Images</option>
22+
<option value="example1.php">Database</option>
23+
<option value="example1.php">Bands</option>
24+
<option value="example1.php">Multcolumn-Verticle</option>
25+
<option value="example1.php">Multcolumn-Horizontal</option> -->
26+
</select>
27+
</label>
28+
<button onclick="changeformat()">Reload</button>
29+
<iframe src="" id="iframereport" style="width: 95vw; height:90vh;border:none">
30+
31+
</iframe>
32+
</body>
33+
</html>

0 commit comments

Comments
 (0)