-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3 --> | ||
<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="jasper" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="812bd71a-1818-447c-8f44-ce4ad6b96e43"> | ||
<property name="com.jaspersoft.studio.data.sql.tables" value=""/> | ||
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="relatorio"/> | ||
<queryString language="SQL"> | ||
<![CDATA[SELECT codigo, nome FROM cidade LIMIT 10]]> | ||
</queryString> | ||
<field name="codigo" class="java.lang.Integer"> | ||
<property name="com.jaspersoft.studio.field.label" value="codigo"/> | ||
<property name="com.jaspersoft.studio.field.tree.path" value="cidade"/> | ||
</field> | ||
<field name="nome" class="java.lang.String"> | ||
<property name="com.jaspersoft.studio.field.label" value="nome"/> | ||
<property name="com.jaspersoft.studio.field.tree.path" value="cidade"/> | ||
</field> | ||
<background> | ||
<band splitType="Stretch"/> | ||
</background> | ||
<title> | ||
<band height="79" splitType="Stretch"> | ||
<staticText> | ||
<reportElement x="205" y="20" width="153" height="30" uuid="8fe107cd-604b-4225-b1c4-4f464adc801b"/> | ||
<textElement textAlignment="Center"> | ||
<font size="20"/> | ||
</textElement> | ||
<text><![CDATA[TEST]]></text> | ||
</staticText> | ||
</band> | ||
</title> | ||
<columnHeader> | ||
<band height="35" splitType="Stretch"> | ||
<staticText> | ||
<reportElement x="0" y="0" width="100" height="30" uuid="1b7c4994-ded6-464d-a553-2c02d69ed417"> | ||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="49846b9b-de68-4ab1-b9b1-b6b27b672343"/> | ||
</reportElement> | ||
<text><![CDATA[nome]]></text> | ||
</staticText> | ||
</band> | ||
</columnHeader> | ||
<detail> | ||
<band height="30" splitType="Stretch"> | ||
<textField> | ||
<reportElement x="0" y="0" width="550" height="30" uuid="7330f3f0-72d3-47b3-ac65-3880f5f79cd9"> | ||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="49846b9b-de68-4ab1-b9b1-b6b27b672343"/> | ||
</reportElement> | ||
<textFieldExpression><![CDATA[$F{nome}]]></textFieldExpression> | ||
</textField> | ||
</band> | ||
</detail> | ||
<columnFooter> | ||
<band height="45" splitType="Stretch"/> | ||
</columnFooter> | ||
<pageFooter> | ||
<band height="54" splitType="Stretch"/> | ||
</pageFooter> | ||
<summary> | ||
<band height="42" splitType="Stretch"/> | ||
</summary> | ||
</jasperReport> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
from pyreportjasper import JasperPy | ||
|
||
def advanced_example_using_database(): | ||
file_name = 'jasper' | ||
input_file_name = '{}.jrxml'.format(file_name) | ||
input_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), input_file_name) | ||
con = { | ||
'driver': 'postgres', | ||
'username': 'postgres', | ||
'password': 'root', | ||
'host': '127.0.0.1', | ||
'database': 'relatorio', | ||
'port': '5432' | ||
} | ||
jasper = JasperPy() | ||
jasper.process( | ||
input_file_path, | ||
format_list=["pdf"], | ||
parameters={}, | ||
db_connection=con, | ||
locale='pt_BR' | ||
) | ||
|
||
if __name__ == '__main__': | ||
advanced_example_using_database() |