xtrareports-402174-feature-guide-to-devexpress-reports-use-report-controls-use-bar-codes-pharmacode.md
Pharmacode is a binary code developed by the German LAETUS GMBH company. The code is widely used in the pharmaceutical industry as a packaging control system. It can be either one-track or two-track.
|
One-Track Pharmacode
|
Two-Track Pharmacode
| | --- | --- | |
|
|
Refer to the Pharmacode specification for more details.
Drag the XRBarCode item from the DX.25.2: Report Controls tab and drop it onto the report.
Set the XRBarCode control’s Symbology property to Pharmacode (an object of the PharmacodeGenerator type).
Specify common barcode properties and properties specific to Pharmacode.
Use the PharmacodeType property to specify whether the Pharmacode has one or two tracks.
The following code creates a one-track Pharmacode 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 CreatePharmacodeBarCode(string BarCodeText) {
// Create a barcode control.
XRBarCode barCode = new XRBarCode();
// Set the type to Pharmacode
barCode.Symbology = new PharmacodeGenerator() {
// Specify the Pharmacode type
PharmacodeType = PharmacodeType.OneTrack
};
// Adjust the appearance.
barCode.Text = BarCodeText;
barCode.Height = 100;
barCode.Width = 220;
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 CreatePharmacodeBarCode(ByVal BarCodeText As String) As XRBarCode
' Create a barcode control.
Dim barCode As New XRBarCode()
' Set the type to Pharmacode
barCode.Symbology = New PharmacodeGenerator() With {.PharmacodeType = PharmacodeType.OneTrack}
' Adjust the appearance.
barCode.Text = BarCodeText
barCode.Height = 100
barCode.Width = 220
Return barCode
End Function
The code example below shows how to create a report with the Pharmacode barcode:
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
//...
var barCode = CreatePharmacodeBarCode("101070");
var report = new XtraReport() {
Bands = {
new DetailBand() {
Controls = { barCode }
}
}
};
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraReports.UI
'...
Private barCode = CreatePharmacodeBarCode("101070")
Dim report As New XtraReport()
Dim band = New DetailBand()
band.Controls.Add(barCode)