GS1 DataBar
- 2 minutes to read
The GS1 DataBar barcode is based on a family of symbols often used in the GS1 DataBar Coupon (coupon codes are commonly used in retail).
Refer to the following article for more details: GS1 DataBar.
Add the Bar Code to a Report
Drag the XRBarCode item from the DX.24.1: Report Controls tab and drop it onto the report.
Set the XRBarCode control’s Symbology property to DataBar (an object of the DataBarGenerator type).
Specify common barcode properties and properties specific to GS1 DataBar.
Specific Properties
-
Specifies the symbol (or set of symbols) in the barcode text that are replaced with the FNC1 functional character when the barcode’s bars are drawn.
-
Gets or sets the type of the GS1 DataBar barcode.
-
Gets or sets the number of data segments per row in the Expanded Stacked type of the GS1 DataBar barcode.
Runtime Example
The following code creates the GS1 DataBar barcode and specifies its properties.
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateDataBarGS1BarCode(string BarCodeText) {
// Create a barcode control.
XRBarCode barCode = new XRBarCode();
// Set the barcode's type to GS1 DataBar.
barCode.Symbology = new DataBarGenerator();
// Adjust the barcode's main properties.
barCode.Text = BarCodeText;
barCode.Width = 250;
barCode.Height = 160;
// Adjust the properties specific to the barcode type.
((DataBarGenerator)barCode.Symbology).FNC1Substitute = "#";
((DataBarGenerator)barCode.Symbology).SegmentsInRow = 4;
((DataBarGenerator)barCode.Symbology).Type = DataBarType.ExpandedStacked;
return barCode;
}
The code example below shows how to create a report with the GS1 DataBar barcode: