Generate Code-barres Data Matrix in Crystal Reports
SAP Crystal Reports 2008 / 2011 / 2013 / 2016 are 32-bit.
SAP Crystal Reports 2020 / 2025 are 64-bit.
1.1 Si votre SAP Crystal Reports est en 64 bits, veuillez enregistrer cruflbcs_x64.dll 64 bits comme indiqué ci-dessous.
Cliquez avec le bouton droit command prompt and run command prompt as administrator.

To register 64-bit DLL, please type in the following commands
cd "C:\Program Files\Common Files\Barcodesoft\FontUtil"
%systemroot%\System32\regsvr32.exe cruflbcs_x64.dll
1.2 Si votre SAP Crystal Reports est en 32 bits, veuillez enregistrer cruflbcs.dll 32 bits comme indiqué ci-dessous.
Type in the following commands to register 32-bit cruflbcs.dll
cd "C:\Program Files (x86)\Common Files\Barcodesoft\FontUtil"
regsvr32.exe cruflbcs.dll

If you see the following Window pop up, your registration was successful.

2. Localisez la fonction UFL.
Naviguez dans la hiérarchie : Liste des fonctions ⇒ Fonctions supplémentaires ⇒ UFL COM et .NET (u212com.dll) ⇒ UFL Visual Basic. Double-click on the BCSDataMatrixEncodeCR fonction.
3. Créez un nouveau champ de formule
Ouvrez votre Crystal Report. Right-click Champs de formule and choose "New..." from the context menu. Set the name to "BcsDataMatrix1", then click "Use Editor".
After Data Matrix encoding process, even a short string might have much more code words than you expect, while Crystal Reports allows no more than 255 characters in a formula field.
Therefore we have to split Data Matrix code words into separate parts, and concatenate them in a Text Object before apply font BcsDataMatrix.
As for how many formula fields are needed, you can find out by using the following function:
BCSDatamatrixFormulaNoForCR({Test.Data})

4. Créez plusieurs champs de formule
Create multiple formula fields as listed below if returned value of BCSDatamatrixFormulaNoForCR({Test.Data}) is larger than one. Then put them in sequence within the same Text Object.
BCSDataMatrixEncodeCR({Test.Data}, 1, 0, 0, 0)
BCSDataMatrixEncodeCR({Test.Data}, 2, 0, 0, 0)
BCSDataMatrixEncodeCR({Test.Data}, 3, 0, 0, 0)

The first parameter in the formula field is string to encode.
The second parameter in the formula field is index.
The third parameter of the formula is Format. Its values range between 0 and 30. When set to zero, it means auto-selected format.
The fourth parameter is Encodation method. Its values range between 1 and 6 which stand for the following encodation separately: ASCII, C40, TEXT, X12, EDIFACT, BASE256.
The fifth parameter is GS1 indicator. It is a Boolean indicating whether this is a GS1-compliant barcode. Set it to zero when this is not GS1-datamatrix compliant.
5. Insérez un objet texte dans votre rapport.
Drag and drop all your formula fields into this text object in sequence. You will see some hex codes in your report. Don't worry! You have NOT applied BCSDatamatrix font typeface yet.

6. Appliquez la police BcsDatamatrix.
Cliquez avec le bouton droit Text Object and choose "Format Object" from context menu. Then choose "BcsDatamatrix" as font.

7. Le Datamatrix est créé dans votre Crystal Reports.
Cliquez sur le bouton OK. You will get data matrix barcode in your report.
