corelibraries-devexpress-dot-xtraprinting-dot-barcode-db82ee90.md
Generates a GS1 (DataBar) barcode.
Namespace : DevExpress.XtraPrinting.BarCode
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public class DataBarGenerator :
BarCodeGeneratorBase
Public Class DataBarGenerator
Inherits BarCodeGeneratorBase
Refer to the GS1 (DataBar) topic for details on this type of barcode.
The following code creates the GS1 DataBar barcode and specifies its properties:
View Example: How to add a bar code to a report
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;
}
Imports System
Imports System.Collections.Generic
Imports System.Drawing.Printing
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI
' ...
Public Function CreateDataBarGS1BarCode(ByVal BarCodeText As String) As XRBarCode
' Create a barcode control.
Dim barCode As 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.
CType(barCode.Symbology, DataBarGenerator).FNC1Substitute = "#"
CType(barCode.Symbology, DataBarGenerator).SegmentsInRow = 4
CType(barCode.Symbology, DataBarGenerator).Type = DataBarType.ExpandedStacked
Return barCode
End Function
Object DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase BarCodeGeneratorBase DataBarGenerator
See Also