Skip to main content

DataBarGenerator Class

Generates a GS1 (DataBar) barcode.

Namespace: DevExpress.XtraPrinting.BarCode

Assembly: DevExpress.Printing.v24.2.Core.dll

Declaration

public class DataBarGenerator :
    BarCodeGeneratorBase

Remarks

Refer to the GS1 (DataBar) topic for details on this type of barcode.

Example

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;
}

Inheritance

Object
DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase
BarCodeGeneratorBase
DataBarGenerator
See Also