
Click
here to view the image in full size.
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 to exploit
the the Crystal Reports UFL (User Function Library).
Anther method is to use Morovia Formula written
in native Crystal Reports language. This article
explains how to use Crystal Reports Formulas. If
you are interested with working with UFL, click
here.
Crystal Formula is supported on Crystal
Reports 9 and above.
Advantages of using Crystal Reports Formula
- The formulas are embedded in the report
file itself so all you need is to distribute
the report file.
- Formula is easy to to use and maintain.
We use Crystal Reports version 9 for tutorial.
You are permitted to use
the Formulas provided by Morovia for free as long as
you own a valid license to the font product. You
are also allowed to distribute the formula with
your report outside your organization with the
purchase of a distribution license.
The Morovia Formula component is included in every Fontware
package (demo and release) as wells in Morovia Font
Tools. To download the most recent version of
Font Tools, visit
Morovia Font Tools page at
http://www.morovia.com/font/support/font-tool.asp.
After you installed Morovia Font Tools, you
can add Morovia Formulas into the Crystal
Reports Repository to make them available to
every new reports. To do this, perform the
following steps:
- Locate Morovia sample file(crLinearFormulas.rpt.rpt) under
MoroviaFontTools folder (usually it is under
c:\program files\common
files\Morovia\MoroviaFontTools folder). Open the
file with Crystal Report by double clicking
the file in Windows explorer.
- From the main menu select Report |
Formula Workshop... to pop up the Formula
Workshop. Expand the first node - Report
Custom Function. click every function to
view the contents. Then click the "Add to
Repository" button to add the function into
Repository. Add every function into the
Repository. If the program prompts that a
version has already existed, click yes.
After you finish, close the Formula Workshop
and then close the sample.
Now you are ready to use Morovia Formulas.
You are now ready to use the functions.
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.

- First we switch to the design view of the
report. This can be done by choosing View |
Design or by pressing Ctrl+D.
- Now choose View | Field Explorer to have
Field Explorer appear at the right side of the
work space.
- We are now ready to add the barcode field.
Right click the Formula Fields to have the context
menu pop up. Choose New...
- 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.
- Click on the Use Expert button. The Formula
Workshop dialog pops up. Find Morovia barcode functions
under the Repository Customer Functions |
Crystal Repository | MoroviaFontTools
section. If you can not find such section,
it is likely that you did not add them into
the respository.

- Select the appropriate barcode function
(in our case is Code128C ), double
click it to make it appear in the bottom panel.
Select the argument. 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.
- Dismiss the Formula workshop and return to
the Field Explorer dialog.
- Drag the new filed from Field Explorer to
anywhere you want to place in the report.
- Click on this new field, and format it with
appropriate barcode font. In our case, we use
"MRV Code128SA" and point size 12. Dismiss the
format dialog.
- 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 purchased the
retail version.

Once you finish the report design, you can
distribute your report application with Crystal
run time files, barcode fonts. You do not need
to distribute Morovia Formulas, since they are
included in the report file.
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 must be obtained. You may review the license
agreement here.
File List
Using the Formula method, you do not need to
distribute any run time DLLs. However, you do
need to distribute the font files which can be
located in the Fontware folder under
C:\program files\morovia.
Morovia Formulas implement all the functions listed
in the Font Tools page.
They are very easy to use and remember. All functions take one single
parameter. For details, click
here.
|