Data Matrix is a kind of 2D barcode that is able to encode more than 1000 alphanumeric characters.
To print
Data Matrix barcode in Crystal Reports, you need Barcodesoft UFL (User Function Library) and BCSDatamatrix barcode font.
1. Open DOS prompt.
If you are using Windows Vista or Windows 7, please Open DOS prompt as administrator.
Go to the following folder
CD C:\Program Files (x86)\Common Files\Barcodesoft\FontUtil
Type in the following DOS command to register crUFLbcs.dll
regsvr32 crUFLbcs.dll
If registration fails, please use another DOS command to register it.
Regtlibv12 is a utility of Windows .NET Framework 2.0.
Regtlibv12 _cruflbcs.tlb
2. If you are using Crystal Reports 9 or above, please open BCSDataMatrix.rpt from
C:\Program Files (x86)\Barcodesoft\datamatrixFont folder.
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 to the Text Object.
As for how many formula fields are needed, you can find out by using the following function BCSDatamatrixFormulaNoForCR.
Right click Formula Field from Field Explorer View, choose "New..." from the context menu as shown below to create a data matrix formula field.
3. Create more formula fields as listed below if returned code words are more than 255. Then put them all in sequence within the same Text Object.
BCSDataMatrixEncodeCR({Test.Data}, 1, 0, 0, 0, 0)
BCSDataMatrixEncodeCR({Test.Data}, 2, 0, 0, 0, 0)
BCSDataMatrixEncodeCR({Test.Data}, 3, 0, 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.
For detailed explanation of parameters, please refer to
Data Matrix UserManual.
4. Right click Text Object and choose Format Object from context menu. Then choose "BcsDataMatrix" as font typeface for the Text Object.
Data matrix barcode will show up in your report.