Home > Crystal Reports Barcode DLL > .NET Crystal Barcode Generation > Data Matrix 2D Barcode Generator Component for .NET Crystal Reports

Data Matrix .NET Crystal Reports Barcode Control

Professional Data Matrix Barcode Creaion Control DLL for .NET Crystal Reports Project
  • Compile Data Matrix barcode creating capabilities into a strong named .NET Crystal Reports Barcode Library SDK
  • Work perfectly with Visual Studio & .NET Framework 2.0, 3.0, 3.5, 4.0 versions
  • Generate & add 2d Data Matrix on Crystal Reports for ASP.NET web services & .NET Windows
  • Capable of customizing generated Data Matrix using Visual C# code or Visual Basic code
  • Also support QR Code and Data Matrix 2d (matrix) barcode generation on Crystal Reports
  • Provide detail online guide for Crystal Reports barcode generation for ASP.NET web & Windows applications
  • Enjoy free 6-month Premium Support & free 12-month Software Update with a purchased Crystal Reports Barcode Generator Control License
The Data Matrix Barcode Control for Crystal Reports is designed to generate high-quality Data Matrix barcode symbols within Crystal Report documents. Data Matrix barcodes can be preserved in exported file formats such as PDF, Word, Excel, and Rich Text Format (RTF).

This guide provides a structured, step-by-step methodology for generating Data Matrix (a 2D matrix barcode symbology) within Crystal Reports for .NET across ASP.NET, WinForms, and WPF projects. It covers core implementation, data encoding, dimension configuration, color and image settings, and advanced features to ensure seamless integration with Crystal Reports components and compliance with industry standards.



How to Print Data Matrix in Crystal Reports?

We have prepared detailed step-by-step instructions how to create, print barcodes in Crystal Reports report in ASP.NET and Windows Forms application.

The above ASP.NET and WinForms demo application will create and print Code 128 barcodes in the report. To generate Data Matrix barcodes in the report, you need do the following code modification.
    • For ASP.NET web application, open file Default.aspx.cs in Visual Studio, go to method Page_Load
    • For WinForms application, open file Form1.cs in Visual Studio, go to method Form1_Load
  1. Create new barcode object from class DataMatrixCrystal.
    protected void Page_Load(object sender, EventArgs e)
    {
        //LinearCrystal barcode = new LinearCrystal();
        DataMatrixCrystal barcode = new DataMatrixCrystal();
    
  2. Set barcode image size in Crystal Reports report designer.
    • Open report file CrystalReport1.rpt in Visual Studio. Click the Barcode item, change the properties:
    • Property XScaling value to the same value in barcode property ImageWidth
    • Property YScaling value to the same value in barcode property ImageHeight
Here is a sample report with Data Matrix barcodes printed in web browser.



How to Encode Complex Text String in Data Matrix within Crystal Reports

Encode ASCII Non-Printable Characters

Non-printable ASCII characters (control chars), such as carriage return, require special handling for Crystal Reports integration:
  • Replace non-printable characters with a tilde (~) followed by a three-digit ASCII value (e.g., carriage return becomes ~013).
  • Set ProcessTilde to true to enable tilde processing.
DataMatrixCrystal barcode = new DataMatrixCrystal();
barcode.ProcessTilde = true;
barcode.Data = "Data~013Matrix";



Render Data Matrix with Unicode Text Encoded

To encode Unicode text (e.g., multilingual data) in Crystal Reports for ASP.NET, WinForms, or WPF:
  • Instantiate a DataMatrixCrystal object.
  • Set the Data property with the Unicode text; this can be bound to a Crystal Reports parameter field.
  • Enable IsUnicodeData to true to activate Unicode support.
  • Generate the Data Matrix 2D barcode for rendering in the CrystalReportViewer.
DataMatrixCrystal barcode = new DataMatrixCrystal();
barcode.IsUnicodeData = true;
barcode.Data = "你好";



Additional Supported Data Formats

Data Matrix in Crystal Reports supports advanced data formats:


Data Matrix Dimension Size in Report

Quick Data Matrix Image Width Configuration

To generate a square Data Matrix image with a specified width suitable for Crystal Reports report page details section.
  1. Set Data Matrix size using barcode library
    • Set property UOM with the report same unit of measure.
    • Set the value of the ImageWidth parameter as the side length of the square Data Matrix.
    barcode.UOM = UnitOfMeasure.INCH;
    barcode.ImageWidth = 2;
    

  2. Set barcode item image size in report designer
    Click the barcode item in the report designer, set the properties
    • Set XScaling to 2
    • Set YScaling to 2
Note: In Crystal Reports the default unit of measure is inch. During barcode generation, we recommend you to set property UOM (barcod image unit of measure) to value UnitOfMeasure.INCH also.


Rectangular Data Matrix Size Configuration

Data Matrix (ECC200) supports six rectangular symbol sizes, which are ideal for narrow Crystal Reports details sections:
    • Initialize a DataMatrixCrystal object with the target data.
    • Set Format to the desired rectangular size (e.g., Format_16X48).
    • Define the Data Matrix barcode width and height to match the symbol's row and column ratio, which is critical for Crystal Reports layout consistency.
    DataMatrixCrystal barcode = new DataMatrixCrystal();
    barcode.Format = DataMatrixFormat.Format_16X48;
    barcode.UOM = UnitOfMeasure.INCH;
    barcode.ImageWidth = 3;
    barcode.ImageHeight = 1;
    

  1. Click the barcode item in the report designer, set the properties
    • Set XScaling to 3
    • Set YScaling to 1


How to customize Data Matrix with colors and image settings?

Data Matrix Module Color Configuration

Data Matrix supports custom foreground and background colors. However, scanner compatibility should be validated when colors deviate from standard black and white, particularly for reports printed or exported via Crystal Reports Server.

barcode.ModuleColor = Color.Red;
barcode.BackgroundColor = Color.White;



Image Settings

Using Crystal Reports Barcode library, you can create and print high resolution (dpi) Data Matrix image in report and Data Matrix barcode image with transparent background in report
  • Set property Resolution with a high value (such as 900) for high quality barcode report printing.
  • Set property BackgroundColor with value Color.Transparent to draw Data Matrix with transparent background in the report.
barcode.Resolution = 1200;
barcode.BackgroundColor = Color.Transparent;


Advanced Data Matrix Features for Crystal Reports

Format Mode Customization

The Data Matrix Format property specifies the symbol size, with 24 square and 6 rectangular ECC200 formats available to fit the Crystal Reports layout.

barcode.Format = DataMatrixFormat.Format_36X36;


Structured Append Mode

To split large datasets across multiple Data Matrix barcodes (e.g., for Crystal Reports subreport data), Structured Append mode can be enabled:
  • Set EnableStructuredAppend to true to print Data Matrix in Structured Append mode.
  • Set StructuredAppendCount to the total number of Data Matrix barcodes.
  • Set StructuredAppendIndex to the order index of the current Data Matrix barcode (starting from 0).
  • Set StructuredAppendFileID to a unique random integer. All Data Matrix barcodes storing the same data message must share the same StructuredAppendFileID value.
barcode.EnableStructuredAppend = true;
barcode.StructuredAppendCount = 3;
barcode.StructuredAppendIndex = 0;
barcode.StructuredAppendFileID = 99;



GS1 FNC1 (First Position)

To enable GS1 Data Matrix generation for supply chain reporting within Crystal Reports, set the FNC1Mode property to DataMatrixFNC1Mode.FirstPosition.

barcode.FNC1Mode = DataMatrixFNC1Mode.FirstPosition;



More about Data Matrix Barcode Data Character Encoding



Valid Encoding Character Set

Data Matrix (supported in Crystal Reports for .NET) supports the following character sets:
  • Full ASCII table (all 128 characters defined in ISO/IEC 646)
  • Extended ASCII (ISO 8859-1 values 128 - 255)
  • Other character sets (Arabic, Cyrillic, Greek, Hebrew) via the Extended Channel Interpretation (ECI) protocol, compatible with Crystal Reports data source binding


Maximum Data Length

Data Matrix data capacity varies by encoding mode, which is critical for Crystal Reports filtering and grouping of large datasets:
  • Alphanumeric data: Up to 2,335 characters (suitable for Crystal Reports summary field labels)
  • Byte data (8-bit): 1,555 characters (compatible with ADO.NET DataSet binding)
  • Numeric data: 3,116 digits (suited for Crystal Reports group header numeric identifiers)


Data Matrix Encoding Data Mode

The Data Matrix symbology uses six encoding modes to optimize data storage. The BarcodeLib library automatically selects the optimal mode when Encoding is DataMatrixEncoding.AUTO, which is recommended for dynamic Crystal Reports data:
  • ASCII (DataMatrixEncoding.ASCII): Double-digit numerics, ASCII 0 - 127, Extended ASCII 128 - 255
  • C40 (DataMatrixEncoding.C40): Upper-case alphanumeric, lower case and special characters
  • Text (DataMatrixEncoding.Text): Lower-case alphanumeric, upper case and special characters
  • X12 (DataMatrixEncoding.X12): ANSI X12 EDI dataset
  • EDIFACT (DataMatrixEncoding.EDIFACT): ASCII 32 - 94
  • Base256 (DataMatrixEncoding.Base256): All byte values 0 - 255
barcode.Encoding = DataMatrixEncoding.AUTO;

Note: Manually setting the encoding mode, such as Base256, is required when handling binary data in Crystal Reports formula field values.


Summary

This guide has demonstrated how to create, print, and customize Data Matrix 2D barcodes in Crystal Reports using the BarcodeLib Barcode Generator for Crystal Reports .NET library.
  • Generate Data Matrix barcodes in C# and bind them to Crystal Reports for .NET using ReportDocument, CrystalReportViewer, and .rpt file templates. The same approach applies to WinForms, WPF (via WindowsFormsHost), and ASP.NET Web Forms, with VB.NET syntax following the same pattern.
  • Utilize automatic or manual encoding modes to support ASCII, Unicode, and GS1 data. Non-printable characters are handled through tilde processing, which is essential for binding to Crystal Reports formula fields and parameter fields.
  • Customize barcode dimensions (square or rectangular), colors, and image formats to align with Crystal Reports layout requirements across headers, footers, and details sections. Advanced features such as Structured Append provide scalability for large datasets.
More Tutorials for Crystal Reports 2D & Linear Barcode Generating
Linear (1D) Barcodes:
Matrix(2D) Barcodes: