Back to Devexpress

GS1 QR Code

xtrareports-404336-feature-guide-to-devexpress-reports-use-report-controls-use-bar-codes-gs-1-qr-code.md

latest5.6 KB
Original Source

GS1 QR Code

  • Feb 18, 2026
  • 3 minutes to read

GS1 QR Code is a variant of the QR Code symbology that conforms to GS1 General Specification.

Add a Bar Code to a Report

  1. Drag the XRBarCode item from the DX.25.2: Report Controls tab and drop it onto the report.

  2. Set the XRBarCode control’s Symbology property to QRCodeGS1 (an object of the QRCodeGS1Generator type).

  3. Specify common barcode properties and properties specific to GS1 QR Code.

Specific Properties

AutoModuleGets or sets whether the Module property value should be calculated automatically based on the barcode size.CompactionModeGets or sets whether numeric, alphanumeric or byte mode should be used to encode the barcode’s data.ErrorCorrectionLevelGets or sets the amount of redundancy built into the bar code’s coding, to compensate for calculation errors.VersionGets or sets the barcode’s version.IncludeQuietZoneGets or sets whether to add a blank space around the QR code.LogoSpecifies the image that overlays the QR code.FNC1SubstituteSpecifies the symbol (or set of symbols) in the bar code’s text that will be replaced with the FNC1 functional character when the bar code’s bars are drawn.FrameOptionsGets or sets the frame for QR codes.

Runtime Example

The following code creates a GS1 QR Code barcode and specifies its properties:

View Example: How to Add a Bar Code to a Report

csharp
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateQRCodeGS1BarCode(string BarCodeText) {
    // Create a barcode control.
    XRBarCode barCode = new XRBarCode();

    // Set the barcode's type to QRCode.
    barCode.Symbology = new QRCodeGS1Generator();

    // Adjust the barcode's main properties.
    barCode.Text = BarCodeText;
    barCode.Width = 400;
    barCode.Height = 150;

    // If the AutoModule property is set to false, uncomment the next line.
    barCode.AutoModule = true;
    // barcode.Module = 3;

    // Adjust the properties specific to the barcode type.
    ((QRCodeGS1Generator)barCode.Symbology).CompactionMode = QRCodeCompactionMode.AlphaNumeric;
    ((QRCodeGS1Generator)barCode.Symbology).FNC1Substitute = "#";
    ((QRCodeGS1Generator)barCode.Symbology).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.H;
    ((QRCodeGS1Generator)barCode.Symbology).Version = QRCodeVersion.AutoVersion;

    return barCode;
}
vb
Imports System
Imports System.Collections.Generic
Imports System.Drawing.Printing
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI
' ...
Public Function CreateQRCodeGS1BarCode(ByVal BarCodeText As String) As XRBarCode
    ' Create a barcode control.
    Dim barCode As New XRBarCode()

    ' Set the barcode's type to QRCode.
    barCode.Symbology = New QRCodeGS1Generator()

    ' Adjust the barcode's main properties.
    barCode.Text = BarCodeText
    barCode.Width = 400
    barCode.Height = 150

    ' If the AutoModule property is set to false, uncomment the next line.
    barCode.AutoModule = True
    ' barcode.Module = 3;

    ' Adjust the properties specific to the barcode type.
    CType(barCode.Symbology, QRCodeGS1Generator).CompactionMode = QRCodeCompactionMode.AlphaNumeric
    CType(barCode.Symbology, QRCodeGS1Generator).FNC1Substitute = "#"
    CType(barCode.Symbology, QRCodeGS1Generator).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.H
    CType(barCode.Symbology, QRCodeGS1Generator).Version = QRCodeVersion.AutoVersion

    Return barCode
End Function

The code example below shows how to create a report with a GS1 QR Code barcode:

csharp
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
//...

var barCode = CreateQRCodeGS1BarCode("0123456789");

var report = new XtraReport() {
    Bands = {
        new DetailBand() {
            Controls = { barCode }
        }
    }
};
vb
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI
'...

Private barCode = CreateQRCodeGS1BarCode("0123456789")

Dim report As New XtraReport()
Dim band = New DetailBand()
band.Controls.Add(barCode)