Utilisation de JasperReport
Bonjour,
je veux afficher un état en utilisant jasperReport.J'ai trouvé sur le net ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
public static void main(String[] args)
{
try {
String path = "D:\\Reports\\report1.jasper";
JasperPrint jasperPrint = JasperFillManager.fillReport(path, new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint, "D:/temp/Simple_report.pdf");
} catch (Exception e) {
System.out.println(e.getMessage());
}
} |
j'obtiens toujours l'erreur suivante : Error loading object from file : D:\Reports\report1.jasper
ici le fichier xml du report:
Code:
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
|
<?xml version="1.0" encoding="UTF-8"?>
<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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="cdf178dd-89e5-42c6-b317-7edc2277ba40">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<textField>
<reportElement x="205" y="21" width="100" height="20" uuid="70ee6dc3-f8a7-43fe-ac3a-7d0e790541f0"/>
<textFieldExpression><![CDATA["Bonjour"]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport> |
c'est un fichier simple et ne comporte qu'un titre à afficher, il ne nécessite pas une connexion à la BD.
merci pout votre aide