IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Jasper Discussion :

Génération de code barre


Sujet :

Jasper

  1. #1
    Membre habitué
    Inscrit en
    Octobre 2005
    Messages
    259
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Octobre 2005
    Messages : 259
    Points : 126
    Points
    126
    Par défaut Génération de code barre
    Bonjour,

    J'aimerais générer des codes barres.
    Le problème est que j'ai toujours l'erreur suivante :

    package it.businesslogic.ireport.barcode does not exist
    J'utilise IReport et mon jasper est compilé depuis Eclipse.
    J'ai ajouté la librairie Barbecue au classpath.
    Qqun a-t-il une idée ?

    Merci d'avance

  2. #2
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : Maroc

    Informations professionnelles :
    Activité : Freelancer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Points : 2 914
    Points
    2 914
    Par défaut
    Donne nous plus de détails (le JRXML ressemble à quoi?, ton code JAVA?...).
    je n'ai jamais travaillé sur cet aspect de code barre mais je peux aider si tout est clair

  3. #3
    Membre habitué
    Inscrit en
    Octobre 2005
    Messages
    259
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Octobre 2005
    Messages : 259
    Points : 126
    Points
    126
    Par défaut
    Voici le JRXML (comme j'essaie d'utiliser les codes barres, j'ai juste un code barre dans la zone DETAIL) :

    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
    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
    74
    75
    76
    77
    <?xml version="1.0" encoding="UTF-8"  ?>
    <!-- Created with iReport - A designer for JasperReports -->
    <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport
    		 name="AVIS_2"
     
    		 language="groovy"		 columnCount="1"
    		 printOrder="Vertical"
    		 orientation="Portrait"
    		 pageWidth="595"
    		 pageHeight="842"
    		 columnWidth="535"
    		 columnSpacing="0"
    		 leftMargin="30"
    		 rightMargin="30"
    		 topMargin="20"
    		 bottomMargin="20"
    		 whenNoDataType="NoPages"
    		 isTitleNewPage="false"
    		 isSummaryNewPage="false">
    	<property name="ireport.scriptlethandling" value="2" />
    	<property name="ireport.encoding" value="UTF-8" />
    	<import value="java.util.*" />
    	<import value="net.sf.jasperreports.engine.*" />
    	<import value="net.sf.jasperreports.engine.data.*" />
     
    	<parameter name="NO_COMMANDE" isForPrompting="false" class="java.lang.String">
    		<defaultValueExpression ><![CDATA[""]]></defaultValueExpression>
    	</parameter>
    	<queryString><![CDATA[select * from dual]]></queryString>
     
    	<field name="DUMMY" class="java.lang.String"/>
     
    		<background>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</background>
    		<title>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</title>
    		<pageHeader>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</pageHeader>
    		<columnHeader>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</columnHeader>
    		<detail>
    			<band height="100"  isSplitAllowed="true" >
    				<image  scaleImage="RetainShape" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
    					<reportElement
    						x="188"
    						y="16"
    						width="163"
    						height="62"
    						key="barcode-1"/>
    					<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
    					<graphicElement stretchType="NoStretch" pen="None"/>
    					<imageExpression class="java.awt.Image"><![CDATA[it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(7,$P{NO_COMMANDE},false,false,null,0,0)]]></imageExpression>
    				</image>
    			</band>
    		</detail>
    		<columnFooter>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</columnFooter>
    		<pageFooter>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</pageFooter>
    		<summary>
    			<band height="0"  isSplitAllowed="true" >
    			</band>
    		</summary>
    </jasperReport>
    Au niveau de JAVA, je fais juste un appel

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    Map<String, Object> parametres = new HashMap<String, Object>();
    parametress.put("NO_COMMANDE", "BAN05072008000015");
    JasperPrint print = JasperFillManager.fillReport(path, parametres , con);
    JasperViewer.viewReport(print);
    J'obtiens maintenant l'erreur suivante : (lors de l'exécution, avant c'était à la compilation)

    Error evaluating expression :
    Source text : it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(7,$P{NO_COMMANDE},false,false,null,0,0)
    groovy.lang.MissingPropertyException: No such property: it for class: AVIS_2_1212482471788_541619
    at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:888)
    at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:2077)
    at gjdk.groovy.lang.MetaClassImpl_GroovyReflector.invoke(Unknown Source)
    at groovy.lang.MetaMethod.invoke(MetaMethod.java:115)
    at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:713)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:560)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:450)
    at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:119)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:111)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:187)
    at AVIS_2_1212482471788_541619.getProperty(calculator_AVIS_2_1212482471788_541619)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getGroovyObjectProperty(ScriptBytecodeAdapter.java:560)
    at AVIS_2_1212482471788_541619.evaluate(calculator_AVIS_2_1212482471788_541619:156)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:186)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:537)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:505)
    at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:811)
    at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:443)
    at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:426)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:274)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:403)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1380)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:768)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:672)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:363)
    at ch.idinfo.basis.reporting.ReportingExporter.fillReport(ReportingExporter.java:225)
    at ch.idinfo.business.presentation.swing.distribution.commande.CommandeBANMainPanel.printOrdreTransport(CommandeBANMainPanel.java:922)
    at ch.idinfo.business.presentation.swing.distribution.commande.CommandeBANMainPanel$10.run(CommandeBANMainPanel.java:898)
    at java.lang.Thread.run(Thread.java:619)

    NESTED BY :
    net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
    Source text : it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(7,$P{NO_COMMANDE},false,false,null,0,0)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:197)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:537)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:505)
    at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:811)
    at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:443)
    at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:426)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:274)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:403)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1380)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:768)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:672)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:363)
    at ch.idinfo.basis.reporting.ReportingExporter.fillReport(ReportingExporter.java:225)
    at ch.idinfo.business.presentation.swing.distribution.commande.CommandeBANMainPanel.printOrdreTransport(CommandeBANMainPanel.java:922)
    at ch.idinfo.business.presentation.swing.distribution.commande.CommandeBANMainPanel$10.run(CommandeBANMainPanel.java:898)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: groovy.lang.MissingPropertyException: No such property: it for class: AVIS_2_1212482471788_541619
    at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:888)
    at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:2077)
    at gjdk.groovy.lang.MetaClassImpl_GroovyReflector.invoke(Unknown Source)
    at groovy.lang.MetaMethod.invoke(MetaMethod.java:115)
    at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:713)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:560)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:450)
    at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:119)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:111)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:187)
    at AVIS_2_1212482471788_541619.getProperty(calculator_AVIS_2_1212482471788_541619)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getGroovyObjectProperty(ScriptBytecodeAdapter.java:560)
    at AVIS_2_1212482471788_541619.evaluate(calculator_AVIS_2_1212482471788_541619:156)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:186)
    ... 20 more
    Encore merci pourle coup de main

  4. #4
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : Maroc

    Informations professionnelles :
    Activité : Freelancer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Points : 2 914
    Points
    2 914
    Par défaut
    Donne moi s'il te plaît tout le code de ta classe JAVA pour tout tester.
    La table dual sert à quelque chose ou que je peux l'enlever?

  5. #5
    Membre habitué
    Inscrit en
    Octobre 2005
    Messages
    259
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Octobre 2005
    Messages : 259
    Points : 126
    Points
    126
    Par défaut
    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
    package ch.essai;
     
    import java.util.HashMap;
    import java.util.Map;
     
    import net.sf.jasperreports.engine.JREmptyDataSource;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.view.JasperViewer;
     
    public class Launcher {
     
    	public static void main(String[] args) {
    		Map<String, Object> parametres = new HashMap<String, Object>();
    		parametres.put("NO_COMMANDE", "BAN05072008000015");
    		String path = "/AVIS_2.jasper";
    		try {
    			JasperPrint print = JasperFillManager.fillReport(path, parametres , new JREmptyDataSource());
    			JasperViewer.viewReport(print);
    		} catch (Throwable e) {
    			System.out.println(e.getMessage());
    		}
    	}
    }
    Et j'obtiens :
    Error evaluating expression :
    Source text : it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(7,$P{NO_COMMANDE},false,false,null,0,0)
    Non tu peux enlever la table dual

Discussions similaires

  1. Génération des Code-barres
    Par identifia dans le forum iReport
    Réponses: 4
    Dernier message: 27/10/2010, 11h34
  2. Génération de code barre
    Par Raptor92 dans le forum WinDev
    Réponses: 0
    Dernier message: 06/07/2009, 12h10
  3. génération de code barre
    Par mateuil dans le forum Windows Forms
    Réponses: 9
    Dernier message: 16/01/2008, 15h49
  4. Génération de code barre
    Par kprime1 dans le forum ASP.NET
    Réponses: 1
    Dernier message: 14/04/2007, 03h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo