Skip to main content

UPC-E0

  • 3 minutes to read

UPC-E is a shorter version of UPC-A. It omits the number system digit, leading zeros in the manufacturer code, and trailing zeros in the product code. UPC-E is used on products with small packaging where a full UPC-A barcode does not fit.

The UPC-E0 is a type of UPC-E code with the number system set to 0. In the human-readable barcode string, the first digit is the number system (always 0 for this code type), and the last digit is the check digit of the original UPC-A code.

Barcode - UPC-E

In the above example, the original UPC-A code is 04210000526. This code (without the number system) is transformed into 425261, the checksum digit (4) is calculated automatically. The number system, the code, and the checksum digit are encoded in a format scanners can read.

Note

You should assign a code to the barcode’s Text property without a leading zero, since this digit is generated automatically. If it is not possible to convert a 10-digit code to a six-digit code, the barcode displays the “Invalid text format” error, and the digits to the right of the 10-th digit in the code are ignored.

Refer to the following article for additional information: UPC-E.

Add the Bar Code to a Report

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

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

  3. Specify common barcode properties.

Runtime Example

The following code creates the UPC-E0 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 CreateUPCE0BarCode(string BarCodeText) {
    // Create a barcode control.
    XRBarCode barCode = new XRBarCode();

    // Set the barcode's type to UPC-E0.
    barCode.Symbology = new UPCE0Generator();

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

    return barCode;
}

The code example below shows how to create a report with the UPC-E0 barcode:

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

var barCode = CreateUPCE0BarCode("4210000526");

var report = new XtraReport() {
    Bands = {
        new DetailBand() {
            Controls = { barCode }
        }
    }
};