| |
   
Morovia.com Home | Fonts | Components | Labeling | Library | Order | Forums  
   Search for

   Advanced Search
 

 

Home >> Fontware >> Support >> Using Barcode Fonts in Crystal Reports (I) - UFL

Using Barcode Fonts in Crystal Reports (I) - UFL

on this page

Click here to view the image in full size.

Introduction

To generate a barcode in Crystal Reports, what you need is to create a field, calculate the barcode string for the field, and format the field with appropriate barcode fonts. Remember that many symbologies require start/stop characters as well as check characters - so you can not just format the field with the barcode format - you must convert the input to a valid barcode string.

There are two methods using external functions in Crystal Reports. The most widely used is the Crystal Reports UFL (User Function Library). Anther method is to use Morovia Formula written in native Cyrstal Reports language. This article explains how to use UFL in Crystal Reports, and how to distribute UFL with your report.

Advantages of using UFL

  • Very easy to use. You do not need to write any code.
  • Supported by Crystal Reports since version 6.

Install UFL

We use Crystal Reports version 9 for tutorial. If you are working on an earlier version the steps outlined still apply. You are authorized to use the UFL provided by Morovia for free as long as you use in conjunction with Morovia barcode fonts. You are also allowed to distribute this UFL with your application with a distribution license.

The UFL component is included in every Fontware package (demo and release) as wells in Morovia Font Tools. To download the most recent version of the Font Tools, visit Morovia Font Tools page at http://www.morovia.com/font/support/font-tool.asp.

The UFL functions are automatically available to Crystal Reports once the component is installed in your computer.

Work with Crystal Reports

In the following tutorial we will start with a blank report. In the report we created several database fields. Now we want to add a barcode field which encodes shipping ID. We choose Code128C as the barcode format.

  1. First we switch to the design view of the report. This can be done by choosing View | Design or by pressing Ctrl+D.
  2. Now choose View | Field Explorer to have Field Explorer appear at the right side of the work space.
  3. We are now ready to add the barcode field. Right click the Formula Fields to have the context menu pop up. Choose New...
  4. Give a name to this new filed. In our case we simply call it barcode. You can also use any names compatible with your naming convention.
  5. Click on the Use Editor button. The Formula Editor pops up. Find Morovia barcode functions under the "Additional Functions" section. If you can not find such an item, most likely you installed the Font tool without closing Crystal Report. In this case restart Crystal Report and repeat the steps above.
  6. Select the appropriate barcode function (in our case is MoroviaBarcodeCode128C ), double click it to make it appear in the bottom panel. Move the cursor in between the parenthesis. Put the data field you want to encode. In our case, we put {Sheet1_.CustomerID} because that filed is what we want to present in barcode form. Note that this field needs to be a text string. You can use Crystal Reports function ToText to convert other format into text string.
  7. Dismiss the Formula Editor and return to the Field Explorer dialog.
  8. Drag the new filed from Field Explorer to anywhere you want to place in the report.
  9. Click on this new field, and format it with appropriate barcode font. In our case, we use "MRV Code128CSA" and point size 12. Dismiss the format dialog.
  10. Click on the Preview tab. the barcodes appear. We have successfully build a report with barcode in minutes! Note that this tutorial uses the trial version of the Code128 fontware, so the second barcode contains a "demo" image. This limitation will go away once you purchase the retail version.

Distributing UFL, Fonts with your report application

Once you finish the report design, you can distribute your report application with Crystal run time files, barcode fonts and the UFL library.

License

First you must obtain enough license from Morovia Corporation. You can either purchase single user license for every computer you are going to install; or purchase a Corporate license if you have a large install base within your organization. If you want to distribute outside your company, a distribution license (a.k.a. developer license) must be obtained. You may review the license agreement here.

File List

There are three runtime files needs to be included in the installer:

  1. Morovia Barcode Font Files. The font files can be located at Fontware folder under Morovia directory.
  2. Morovia Crystal UFL. This file contains all the Morovia barcode functions and can be found under Morovia Font Tools directory (c:\program files\common files\Morovia\MoroviaFontTools). Note that you must register the COM object in order to use it. The command line for registration is regsvr32 cruflMorovia.dll.
  3. Crystal Runtime. The file name is U2lcom.dll. This file is required to work with COM UFLs.

Barcode Function Prototype

Morovia UFL implements all the functions listed in the Font Tools page. To save the space we will not list them in this page. They are very easy to use and remember. To conform to the Crystal Reports requirements, all the functions begin with MoroviaBarcode. For example, the function EAN13 listed in Font Tools page is available as MoroviaBarcodeEAN13. All functions take one single parameter. For details, click here.

To top of page