RDLC Barcode How-Tos
PM > Install-Package BarcodeLib.RDLC


Home > .NET RDLC Reports Barcode > RDLC Reports Barcode Generation Guide > Data Matrix Barcode Generation Guide in RDLC Reports

.NET RDLC Reports Data Matrix Barcode Generator

How to create, print Data Matrix in .NET RDLC reports
The Data Matrix barcode control for RDLC is a robust reporting component that enables the creation of comprehensive reporting solutions with integrated barcode generation and printing capabilities.



This library is compatible with VB.NET, C#, Managed C++, and Borland Delphi for .NET, and can be utilized in applications that require RDLC based reporting.


How to Generate Data Matrix in RDLC Using the Barcode Generation SDK

This guide provides step by step instructions for generating Data Matrix 2D barcodes within RDLC (Report Definition Language Client Side) local reports using C#. The approach is compatible with ASP.NET (including Web Forms and MVC), WPF, and Windows Forms (.NET Framework) projects, and integrates seamlessly with the ReportViewer Control for rendering barcodes in RDLC files.

The guide is based on the following tutorials:
  • How to create barcodes in RDLC reports in ASP.NET
  • How to create barcodes in RDLC reports in Windows Forms
The existing demonstration code for Code 128 can be adapted to generate Data Matrix barcodes as described below.
  • Open the file Form1.cs in Visual Studio.
  • Remove the existing Linear object construction code.
  • Create a new DataMatrix object to generate and customize Data Matrix 2D barcodes in the RDLC report file.


Note: Ensure that the MIME type of the RDLC Image control is set to image/png to match the generated Data Matrix barcode image format.


Data Matrix Barcode Data Encoding in RDLC Local Reports (C#)



Valid Encoding Character Sets

Data Matrix supports the following character encodings for RDLC reports:
  • Full ASCII table (all 128 characters)
  • Extended ASCII (ISO 8859-1 values 128 - 255)
  • Additional character sets (e.g., Arabic, Cyrillic) via byte data or the Extended Channel Interpretation (ECI) protocol


Maximum Data Length by Encoding Mode

The RDLC barcode library automatically selects the optimal encoding mode for Data Matrix. Alternatively, the encoding mode can be explicitly set using the following enumeration.

The default value for DataMode is Auto. In this mode, the library automatically selects the most appropriate combination of data modes.


Advanced Data Encoding for Data Matrix in RDLC Local Reports (C#)

Encode ASCII Non Printable Characters

Non printable ASCII characters (e.g., carriage return) require special handling for RDLC reports. Replace non printable characters with a tilde (~) followed by a three digit ASCII value. Enable ProcessTilde and set DataMode to Auto for compatibility.


Verify the printed Data Matrix in the RDLC report by scanning the generated barcode (e.g., in PDF or Excel export) to confirm correct decoding of the non printable character.


Encode Unicode Text

Unicode text can be encoded in Data Matrix barcodes within .NET RDLC local reports. Enable EncodeUnicodeText to support multi language content (e.g., Chinese, French).


Use barcode scanning software or a hardware scanner to validate that the Unicode Data Matrix renders correctly in the ReportViewer Control (Windows Forms) or in the browser (ASP.NET).


Other Supported Data Formats

  • Binary Data: Encode files (e.g., PDFs) into Data Matrix for RDLC reports using Base256 mode.
  • GS1 Data Elements: Enable FNC1 for GS1 compliant barcodes.
  • Structured Append: Split large data across multiple Data Matrix barcodes for RDLC reports, suitable for long reports requiring distributed data storage.


Data Matrix Dimension Size Settings for RDLC Local Reports (C#)

When customizing the dimensions of a generated Data Matrix, adhere to the following guidelines:
  • Define the desired image width and height with a specified unit of measure (pixels, centimeters, or inches).
  • Ensure the RDLC Image control dimensions match the barcode dimensions to prevent distortion.


Rectangular Data Matrix Configuration

RDLC supports rectangular Data Matrix (ECC200) symbols with six standard sizes: 8×18, 8×32, 12×26, 12×36, 16×36, and 16×48 (rows × columns).


Note: When setting the width and height of a rectangular Data Matrix image, the aspect ratio must match the column to row ratio defined by the FormatMode. This ensures that the individual modules remain square.

Verify the RDLC report in the ReportViewer or in a printed PDF to confirm that the rectangular Data Matrix is not stretched.


Advanced Dimension Calculation

The total width of a Data Matrix (including quiet zones) is calculated as follows:

W = Row × X + 2Q

Where:
  • W: Total barcode width
  • Row: Number of modules per row (symbol size)
  • X: Module width
  • Q: Quiet zone width



If the encoded data exceeds the capacity of the specified symbol size, the library automatically selects a larger size. Confirm the resulting size in the RDLC report.


Data Matrix Color and Image Settings for RDLC (C#)

Color Customization

Data Matrix barcodes in RDLC reports support custom foreground and background colors, though standard Data Matrix symbology is dark on light.


Note: Non standard colors may not be compatible with all barcode scanners. Validate using a scanner before deploying to RDLC reports.

Image Format Configuration

RDLC supports multiple raster image formats for Data Matrix, including BMP, GIF, JPG, and PNG. The output format can be specified using the OutputFileFormat property.


Advanced Data Matrix Options for RDLC Local Reports (C#)

Format Mode Customization

The RDLC barcode library supports all 24 square and 6 rectangular ECC200 symbol sizes. Use the FormatMode property to specify a symbol size that fits the RDLC local report layout.


Structured Append Mode

Structured Append allows splitting large data across multiple Data Matrix barcodes for RDLC reports.


GS1 FNC1 Support

Enable GS1 compliance for Data Matrix in RDLC by setting the FNC1 property.


Summary

The core workflow for generating Data Matrix barcodes in an RDLC Local Report consists of the following steps:
  • Generate and customize the Data Matrix barcode byte stream.
  • Bind the byte stream to the RDLC Image report item.
  • Render the report through the ReportViewer Control.
Data Matrix customization parameters include encoding mode (DataMode), dimension settings (BarcodeWidth and FormatMode), and color settings (ForeColor and BackColor). These must be aligned with the properties of the Image report item in the RDLC local report file (.rdlc) to ensure consistent rendering across ASP.NET, Windows Forms, and other .NET project types.

Client RDLC Reports Barcode Generator SDK Supported Symbologies
Linear (1D) Barcodes:
Matrix(2D) Barcodes:
.NET RDLC Reports Barcode DLL Creates Linear Barcodes: Code 39, Code 128, EAN-13, EAN 128/GS1 128, UPC-A.
.NET RDLC Reports Barcode DLL Creates 2D Barcodes: Data Matrix, PDF 417, QR Code.



Related Developer Guide: How to Generate Barcode Images

How to generate barcodes in RDLC Reports for ASP.NET & .NET WinForms projects