Live Chat

Design Reports using iReport and Render BarCode Images

Skip to end of metadata
Go to start of metadata
In this article, we will use iReport to design the reports. iReport is a plug-in for Netbeans which can be used to design the reports visually for JasperReports. The JasperReports .jrxml file is generated by the iReport designer.
To download and install iReport, please find more information on the iReport plug-in site at http://sourceforge.net/projects/ireport/ .
Working

After iReport has been installed as Netbeans plug-in, open Netbeans IDE and select Window Welcome to iReport from the menu.


You will see the above 2 options in the QuickStart window of iReport.
Click on “Step 1” icon and create an empty datasource connection, if it’s not already there in the listbox on top.
Now, click on “Step-2” icon to create a new report. Select “Blank A4” from the page layout list and click on “Launch Report Wizard”. Name the report as report1, select empty datasource connection in the next step and proceed to finish the wizard.
After the report is created on the specified location, it will be opened in iReport designer in Netbeans IDE. Click on the “Palette” window and drag an image from the Palette to the report. We will use this image to render barcode using Aspose.BarCode for JasperReports.


Set the properties of this image as follows:

  • Image Expression: new com.aspose.barcode.jr.BarCodeRenderer(com.aspose.barcode.jr.BarCodeAttributesFactory.Create("test","DataMatrix",java.awt.Color.RED)).
  • Expression Class: net.sf.jasperreports.engine.JRRenderable.

Now, if you go to the XML tab of the report, you will see the following XML for the image tag:

Programming Sample
<image scaleImage="RealSize">
	<reportElement x="103" y="0" width="201" height="174"/>
	<imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[new com.aspose.barcode.jr.BarCodeRenderer(com.aspose.barcode.jr.BarCodeAttributesFactory.Create("test","DataMatrix",java.awt.Color.RED))]]></imageExpression>
</image>
 

This is similar to the samples that we created in the Programmer’s Guide of this documentation. However, here we just used iReport tool to design the report visually.
The report will be now saved as .jrxml file. For compiling and generating the report, you can get more information from the Programmer’s Guide.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.