How to Generate Data Matrix Barcodes in Crystal Reports

A comprehensive step-by-step guide to installing Barcodesoft UFL and using formulas to create high-density 2D barcodes.

1 Register the Barcodesoft UFL DLL

To enable Data Matrix encoding functions, you must register the cruflbcs.dll. Start by running the Command Prompt as Administrator.

Run command prompt as administrator

For 32-bit environments, execute these commands:

cd "C:\Program Files (x86)\Common Files\Barcodesoft\FontUtil"
regsvr32.exe cruflbcs.dll
register cruflbcs.dll commands

For 64-bit environments, execute:

cd "C:\Program Files (x86)\Common Files\Barcodesoft\FontUtil"
%systemroot%\System32\regsvr32.exe cruflbcs_x64.dll

A successful registration will trigger this confirmation:

DLL registration succeeded

2 Create Formula Fields in Crystal Reports

Crystal Reports limits formula fields to 255 characters. Since Data Matrix encoding generates long strings, we must split the data.

  1. Right-click Formula Fields in your Field Explorer and select New.
  2. Name the field BcsDataMatrix1 and click Use Editor.
Create formula in crystal reports

Pro Tip: Use the following function to check how many formula fields you will need based on your data length:

BCSDatamatrixFormulaNoForCR({Test.Data})

Data matrix Crystal Reports UFL

3 Split and Encode Data

Create subsequent formula fields (e.g., BcsDataMatrix2, 3) and use the BCSDataMatrixEncodeCR function:

BCSDataMatrixEncodeCR({Data}, 1, 0, 0, 0)
BCSDataMatrixEncodeCR({Data}, 2, 0, 0, 0)

Parameter Breakdown:

  • 1. String: The data field to encode.
  • 2. Index: The part number (1, 2, or 3).
  • 3. Format: 0-30 (0 = Auto-select).
  • 4. Method: 1-6 (ASCII, C40, TEXT, X12, EDIFACT, BASE256).
  • 5. GS1: Boolean (Set to 0 for non-GS1).
UFL split fields

4 Assemble and Apply Font

Drag a Text Object into your report. Inside this object, place your formula fields in sequence. Initially, you will see a string of hex codes.

Assemble formula fields

Right-click the Text Object and select Format Object. Change the font to BcsDatamatrix.

Apply Data Matrix font

Final Result

Once the font is applied, your report will display a perfectly scannable Data Matrix barcode.

Final Data Matrix in report