Précédent   Forum des professionnels en informatique > Logiciels > Solutions d'entreprise > Business Intelligence > Jasper
Jasper Forum d'entraide sur Jasper Reports. Avant de poster --> FAQ Jasper, Tutoriels Jasper
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 08/04/2008, 14h16   #1
Invité de passage
 
Inscription : mars 2008
Messages : 14
Détails du profil
Informations forums :
Inscription : mars 2008
Messages : 14
Points : 1
Points : 1
Par défaut De word a jrxml de jrxml à word ireport

Bonjour,
J'ai un petit soucis j'ai generé un fichier jrxml à partir d'un fichier word(avec des données: variable... ) et je dois regenerer avec ce fichier jrxml un fichier Word.
Mon code est le suivant :
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import java.io.File;
import java.util.HashMap;
import java.util.Map;	 
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.export.JRRtfExporter;
/**
 * @author bsalhi
 *
 */
public class RTF {
 
//	The folder where your JRXML file is located
	static String myWorkFolder = "D:\\iReport-2.0.5\\generateRTF\\";
 
	//JRXML file you want to export to a report
	static String myJrxmlFile = "LI11134.jrxml";
 
	//Name of the RTF export of your report
	static String myRtfFile = "LI11134.rtf";
 
	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws JRException {
		//We retrieve the jrxml file we want to use
		File file = new File(myWorkFolder, myJrxmlFile);
		JasperDesign design = JRXmlLoader.load(file);
 
		//We compile it to obtain a binary read-only version of the report
		JasperReport report = JasperCompileManager.compileReport(design);
 
		//We fill it with the data from the database
		JasperPrint jasperPrint = JasperFillManager.fillReport(report, null);
 
 
		//Adapted from the sample classes shipped with JasperReports
		Map dateFormats = new HashMap();
		dateFormats.put("EEE, MMM d, yyyy", "ddd, mmm d, yyyy");
		File destFile = new File(myWorkFolder, myRtfFile);
 
		JRRtfExporter exporter = new JRRtfExporter();
 
 
		exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
		exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
 
		exporter.exportReport();
 
		/*try {
 
            // - Chargement et compilation du rapport
            JasperDesign jasperDesign = JRXmlLoader.load("D:\\iReport-2.0.5\\LI11134.jrxml");
            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
 
            // - Paramètres à envoyer au rapport
            Map parameters = new HashMap();
            parameters.put("Titre", "Titre");
 
            // - Execution du rapport
            JasperPrint jasperPrint2 = JasperFillManager.fillReport(jasperReport, parameters);
 
		} catch (Exception e) {
			e.printStackTrace();
		}*/
	}
 
}


ca produit l'erreur suivante :
Code :
1
2
3
4
5
6
7
8
9
10
Exception in thread "main" net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 
	 1. Warning : Element bottom reaches outside band area : y=-7 height=146 band-height=50
	 2. Warning : Element bottom reaches outside band area : y=40 height=15 band-height=50
	 3. Warning : Element bottom reaches outside band area : y=20 height=19 band-height=30
	 4. Warning : Element bottom reaches outside band area : y=80 height=299 band-height=276
	 5. Warning : Element bottom reaches outside band area : y=43 height=18 band-height=50
	at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:260)
	at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:144)
	at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:219)
	at RTF.main(RTF.java:35)
Merci pour votre aide.
heoue est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/05/2008, 23h56   #2
Rédacteur/Modérateur
 
Avatar de JauB
 
Homme Faisel
Ingénieur COBOL/AS400
Inscription : octobre 2005
Messages : 1 713
Détails du profil
Informations personnelles :
Nom : Homme Faisel
Âge : 31
Localisation : Maroc

Informations professionnelles :
Activité : Ingénieur COBOL/AS400
Secteur : Finance

Informations forums :
Inscription : octobre 2005
Messages : 1 713
Points : 2 712
Points : 2 712
Envoyer un message via AIM à JauB Envoyer un message via MSN à JauB Envoyer un message via Yahoo à JauB
Salut,
je pense que la meilleure façon pour t'aider est de nous fournir ton fichier JRXML
__________________
*** Ingénieur COBOL/AS400 ***

-------------------------------------------------------------------

Mes articles, Mon Blog

Rubrique Jasper/iReport :
------- Forum Jasper --------
----- FAQ Jasper/iReport -----

JauB est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 14h59.


 
 
 
 
Partenaires

Hébergement Web