Back to Devexpress

Deutsche Post Leitcode

xtrareports-403079-feature-guide-to-devexpress-reports-use-report-controls-use-bar-codes-deutsche-post-leitcode.md

latest3.5 KB
Original Source

Deutsche Post Leitcode

  • Feb 18, 2026
  • 2 minutes to read

The Deutsche Post Leitcode symbology, or German Postal 2 of 5 LeitCode, LeitCode, or CodeLeitcode, is used by Deutsche Post AG (Deutsche Frachtpost). This barcode identifies the destination.

A value that the barcode encodes should consist of 13 or 14 digits:

  • 5 digits for a Postal Code (Postleitzahl, PLZ);
  • 3 digits for a Street ID/number;
  • 3 digits for a House number;
  • 2 digits for a Product code;
  • 1 digit for a checksum (optional).

When you specify 13 digits, the barcode generates a checksum digit automatically. If you add a checksum digit, the barcode ignores this digit and also generates it automatically to ensure the encoded value is valid.

Add the 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 DeutschePostLeitcode (an object of the DeutschePostLeitcodeGenerator type).

  3. Specify common barcode properties.

Runtime Example

The following code example creates the Deutsche Post Leitcode barcode and specifies its properties.

View Example: How to add a bar code to a report

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

public XRBarCode CreateDeutschePostLeitcodeBarCode(string barcodeText) {
    // Create a XRBarCode control.
    var barCode = new XRBarCode();

    // Set the barcode's symbology to the DeutschePostIdentcode.
    barCode.Symbology = new DeutschePostLeitcodeGenerator();

    // Adjust the barcode's appearance.
    barCode.Text = barcodeText;
    barCode.Height = 100;
    barCode.Width = 320;

    return barCode;
}
vb
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI
'...

Public Function CreateDeutschePostLeitcodeBarCode(ByVal barcodeText As String) As XRBarCode
    ' Create a XRBarCode control.
    Dim barCode = New XRBarCode()

    ' Set the barcode's symbology to the DeutschePostIdentcode.
    barCode.Symbology = New DeutschePostLeitcodeGenerator()

    ' Adjust the barcode's appearance.
    barCode.Text = barcodeText
    barCode.Height = 100
    barCode.Width = 320

    Return barCode
End Function

The code example below shows how to create a report with the Deutsche Post Leitcode barcode:

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

var barCode = CreateDeutschePostLeitcodeBarCode("0123456789012");

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

Private barCode = CreateDeutschePostLeitcodeBarCode("0123456789012")

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