Jump to content
We've recently updated our Privacy Statement, available here ×

arturoi

Members
  • Posts

    1
  • Joined

  • Last visited

arturoi's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi forum, I need to create a report with no previous .jrxml (on the fly) and add a Barbacue element on it. In the jrxml I need create something similar to this: <componentElement> <reportElement x="38" y="171" width="200" height="64"/> <jr:barbecue xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="EAN128" drawText="true" checksumRequired="true" barHeight="40"> <jr:codeExpression>"1234567890"</jr:codeExpression> </jr:barbecue> </componentElement> Can anyone help me please? I saw the nojrxml example but don't see anything similar to a componentElement created on the fly. Thanks in advance for your reply. Code:I tried with this portion of code: JRDesignComponentElement barCode = new JRDesignComponentElement(); barCode.setX(Integer.valueOf(fieldValues.get("x"))); barCode.setY(Integer.valueOf(fieldValues.get("y"))); barCode.setHeight(Integer.valueOf(fieldValues.get("height")) + 25); barCode.setWidth(Integer.valueOf(fieldValues.get("width"))); StandardBarbecueComponent stdBBQComponent = new StandardBarbecueComponent(); stdBBQComponent.setType("EAN128"); stdBBQComponent.setDrawText(false); stdBBQComponent.setChecksumRequired(false); stdBBQComponent.setBarHeight(Integer.valueOf(fieldValues.get("height"))); stdBBQComponent.setEvaluationTimeValue(EvaluationTimeEnum.REPORT); JRDesignExpression designExpression = new JRDesignExpression(); designExpression.setText("$F{" + fieldValues.get("fieldExp") + "}"); stdBBQComponent.setCodeExpression(designExpression); barCode.setComponent(stdBBQComponent);.... but when I try to compile the report design it throws methe following exception:java.lang.NullPointerException at net.sf.jasperreports.engine.component.ComponentsEnvironment.getComponentManager(ComponentsEnvironment.java:138) at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:1364) at net.sf.jasperreports.engine.design.JRDesignComponentElement.collectExpressions(JRDesignComponentElement.java:95) at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:567) at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:547) at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:434) at net.sf.jasperreports.engine.JRExpressionCollector.collector(JRExpressionCollector.java:99) at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:137) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:215)
×
×
  • Create New...