Bonjour,
je n'arrive pas à afficher dans mon rapport une image transmise en paramètre (BufferedImage).
Dans mon état Birt, en utilisant le composant Data, j'arrive à faire afficher :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 IRunAndRenderTask task = engine.createRunAndRenderTask(design); // Passage de paramètres au rapport Map<String, Object> parametres = new HashMap<String, Object>(); // img3 est une instance de BufferedImage parametres.put("monImage", img3); parametres.put("monTitre", "Un test..."); task.setParameterValues(parametres);
* Un test...
* et pour l'image : "BufferedImage@15e00b7: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space
= java.awt.color.ICC_ColorSpace@81018b transparency = 1 has alpha = false isAlphaPre = false
ByteInterleavedRaster: width = 2000 height = 1500 #numDataElements 3 dataOff[0] = 2"
Par contre, si j'utilise le composant "Image", je n'arrive pas à lui indiquer d'utiliser le paramètre "monImage" et à lui faire afficher cette image.
J'ai essayé d'aller sur l'onglet "Liaison" du composant Image et de rajouter un "Data Column Binding", en déclarant : "Liaison de colonne, Type de données : Indifférent, expression : params["monImage"]"...
Ensuite, dans les propriétés avancées de l'image, j'ai mis : "source : expr, taille : size-to-image" mais sans succès.
Voici la stack trace de l'erreur que j'obtiens :
C'est grave docteur ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 [Configuration du moteur BIRT]............OK 21 juin 2008 14:38:48 org.eclipse.birt.report.model.parser.ModuleReader readModule GRAVE: Line Number:233 Error Code:Error.XMLParserException.EXCEPTION Exception:org.eclipse.birt.report.model.parser.DesignParserException: The image reference expression value is invalid. Message:A generic exception occurred. [Lecture de l'état BIRT]........FAILEDThe design file file:/C:/workspace/TestImpression/reports/monRapport.rptdesign has error and can not be run. [Lecture de l'état BIRT]................OK 21 juin 2008 14:38:48 org.eclipse.birt.report.engine.api.impl.ReportEngineHelper openReportDesign GRAVE: invalid design file file:/C:/workspace/TestImpression/reports/monRapport.rptdesign [Configuration du moteur de rendu]......OK [Configuration du fichier de sortie]....OK [Début de l'execution de la transfo.]...OK Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at org.eclipse.birt.report.engine.api.impl.EngineTask.doValidateParameters(EngineTask.java:497) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:79) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:68) at LanceurTestImpression$3.actionPerformed(LanceurTestImpression.java:279) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Comment fait-on pour afficher une image dynamique transmise en paramètre d'un état Birt ?
Merci beaucoup pour votre aide.
F.
Partager