Crystal Reports Barcode Font Formula
Tutorial
- Easily create barcodes with fonts in Crystal Reports without installing
UFLs or DLLs.
- Formulas are saved as part of the report file (.rpt) and do not
have any external dependencies, except the required barcode font.
- Compatible with Crystal 8 and up.
- Embeds font-formatting technology directly into the report.
- Source code included.
- Royalty free.
Support |
Native Barcode Generator
for Crystal |
Font UFL
| Crystal Integration Guide
IDAutomation's Font Formulas for Crystal Reports are saved
as part of the report file (.rpt) and do not have any external dependencies
(with the exception of the required barcode font). If distributing the report,
IDAutomation suggests using this method or implementation of the
Native Barcode Generator
for Crystal Reports, which creates dynamic embedded barcodes without
the installation of any barcode fonts or components.
These formulas are only provided in purchased versions of
some barcode font packages. The formulas have been tested in Crystal Reports
8 and 9 and are compatible with later versions as well. For advanced developers
using Crystal 9 or above, Report Custom Functions may be created from IDAutomation's
formulas and placed into the Repository of Custom Functions. Formulas are
currently only supplied with the following font packages:
Each formula is to be used with the font supplied in the
package. Additional formulas for other fonts will most likely not be created,
because the implementation of the
Native Barcode Generator
offers better performance without installing any barcode fonts or components.
- If there is a doubt as to which font is needed, IDAutomation recommends
the Code 128 Font
Advantage Package, this barcode can encode numbers and letters and
it is very compact. This Crystal Report Barcode tutorial uses Code 128.
When using Code 128 or Interleaved
2 of 5, if the character set is not US English, 1252 Latin-1, 1250 European,
1251 Cyrillic, 1253 Greek, 1254 Turkish, 1255 Hebrew or 1256 Arabic,
the Universal
Barcode Font Advantage™ must be used.
- Purchase and install the appropriate barcode fonts by running the
INSTALL.EXE file if the package contains one.
- Open the Crystal Reports Example from the icon in the program group
or from the "Crystal Reports Formulas" folder of the supplied ZIP file.
- Open Field Explorer; in version 9, choose View - Field
Explorer. In versions prior to 9, choose
Insert - Formula Field. Right click on the selected formula
field and choose Edit to reveal the formula.
- When the source code is on the screen, place the cursor in the code
and (1) do CTRL-A to select all and then (2) do CRTL-C to copy the code.
Close the report example.
- Open a report. Right click on Formula Fields and select
New.
- In the Formula Name dialog box, enter the name to identify the formula.
This can be any name, for example, "BarcodeFormula." In this case "Barcode."

- Click OK. The Formula Editor appears.
- If given an option between expert and editor, choose the Editor.
- Change the syntax of the formula to Basic Syntax.
- Delete any text if it appears in the editor window. Place the cursor
in the editor window and press CTRL-V to paste the new formula into
the window.
- Change the "DataToEncode" statement so it connects to the data source;
for example:
DataToEncode = ({Table.Field})
NOTE: For some double byte language settings such as Chinese,
Korean and Japanese languages, Crystal 9 or greater must be used, replace
every
reference of Chr with ChrW and Asc with
AscW in the formulas for compatibility. Additionally, the
Universal Barcode
Font should be used if possible.
- If an error such as "A string is required" appears, the data will
need to be converted to text with a crystal function.
For example: DataToEncode =
ToText( {Employee.EmployeeID} )
- If Code 128 is used, another formula may be created to return the
Human Readable text. In this tutorial, the @BarcodeHR formula was created
in the same way as @Barcode, except the Code128TEXT formula was copied
from the Crystal Reports Example.
- Return to the Field Explorer dialog box. Click on the formula field
and drag it onto the report.

- Now that the fields have been created in the report, choose the
Preview tab to make sure the data is being pulled from the fields
and properly formatted to the barcode font. Note: Some strange characters
will append to the beginning and ending of the data from the fields
- this is normal. Sometimes the data has to be formatted so much that
it will appear to be scrambled. This is normal for Code 128 and Interleaved
2 of 5 when numbers need to be compressed within the barcode. In the
graphic below, the first string is produced by the @Barcode formula
and the second one is produced by the @BarcodeHR formula which
formats text for the bottom of the barcode.

- Choose the Design tab again and size the Barcode formula
field to display the appropriate barcode font in the report.
- Change the font of the formula field to be the appropriate barcode
font and set the point size to match the scanner specs. This is
a very important step; if this is not done, barcodes will not be displayed.
If unsure of the point size to use, 12 points is suggested. UPC and
EAN fonts should be printed at 22 points or greater.
NOTE: When selecting the font from the pull down menu, do not
use the fonts that begin with the
"@" Symbol.
Instead, scroll down in the list and select the ones that begin with
"IDAutomation."
- When the Preview tab (or File - Print Preview) is selected
barcodes should be seen in the report. Print one page of the report
and test with a barcode scanner. If a scanner is needed, IDAutomation
suggests the easy-to-use
IDAutomation USB Barcode Scanner, which scans all popular linear,
GS1 DataBar and PDF417 barcodes. When 2D Data Matrix, QR Code, Aztec
or Intelligent Mail symbols need to be verified, IDAutomation suggests
the 4600G Hand
Held Products 2D Imager.

- It is also possible to combine multiple fields and place functions
in a single barcode when using the Code 128 Auto formula in a report.
For example, the following formula combines two fields in a single barcode
and places a tab function between them:
DataToEncode =({Table1.DataField1} &
CHR(9) & {Table1.UPC})
The following formula places a return function after the barcode:
DataToEncode = ({Table1.DataField1} &
CHR(13))
Use CHR(9) for tab and
CHR(13) for a return.
For advanced barcode Crystal Report developers using version
9 or above, Report Custom Functions may be created from IDAutomation's formulas
and placed into the Repository of Custom Functions. Follow the procedures
provided in the Crystal Reports documentation to create the function in
the formula workshop and paste the formula (obtained from
IDAutomation Formulas for Crystal Reports)
in the function. For example:
Function IDAutomationCode128 (DataToEncode
as String) as String
<<<include source code here that creates the PrintableString from DataToEncode>>
IDAutomationCode128 = PrintableString
End Function
Then in the Crystal Report, all that is needed is to call the function.
For example:
IDAutomationCode128 ( {Table1.DataField1}
)
NOTE: At this time, IDAutomation's support department does not troubleshoot
Report Custom Functions, therefore IDAutomation recommends reproducing the
problem with the IDAutomation Formulas for Barcode
Crystal Reports Tutorial to obtain support for a particular problem
with the formulas. If there is a problem working with IDAutomation's barcode
fonts,
refer to IDAutomation's barcode font support site. For assistance with
other Crystal reports issues refer to
Crystal Reports Support Site.
Free product support may be obtained by reviewing articles
that are documented at the
IDAutomation's
Barcode Font Support Site and by searching the resolved
public help
desk issues.
Priority phone,
email and help desk support is also provided up to 30 days after purchase.
Additional priority
phone, email and help desk support may be obtained if the
Priority Support
and Upgrade Subscription is active. For assistance with other Crystal
reports issues refer to Crystal
Reports Support Site.
© Copyright 2000-2009 IDAutomation.com, Inc., All Rights
Reserved.
Legal Notices.
|
Over 70% of Fortune 100
companies use IDAutomation's products to automate their businesses.
|
|