How to create Code 11 barcode from FastReport VCL with Delphi / Lazarus / C++ Builder

2022-10-12

Code 11, also known as USD-8, is a discrete, high-density symbology, which is primarily used in labeling telecommunications equipment.

The symbol includes the following elements:

  • Start character;
  • Symbol characters that represent data;
  • Optional checksum digits;
  • Stop character.

Code-11

The first and last element of every character is a bar. A one-module intercharacter space is appended to separate characters from one another.

This character supports numbers (0-9) and hyphen (-). Code 11 takes its name from these 11 characters.

Printing defects due to the natural density of code 11 can cause scanners to misread characters. To compensate for this, code 11 supports one or two optional checksum digits. Data inputs with fewer than 10 numeric characters use one checksum digit, and 10 or more digits use two checksum digits. The first digit is based on the Modulo 11 algorithm and the second is based on the Modulo 9 algorithm.

 

How to create Code 11 from FastReport VCL designer

Add the obCatBarcode component to the report and select Code 11.

Code-11

 

Next, we go to the barcode editor:

Barcode editor

Code — area for the numerical value of the barcode;

Type of Bar — you can change the barcode type in the editor without adding a new component to the report;

Calc CheckSum — this is the checksum. All linear barcodes have this property. Do you remember the “read skip”? We have to do with it something! This property determines whether it is necessary to calculate the checksum automatically. If this property is off, you should provide the checksum in the text object.

Zoom — it sets barcode scaling and is used only with the "Autosize" property;

Text — enable/disable the display of text under the barcode;

Rotation — allows you to set the rotation of the object on one of the fixed angles — 0, 90, 180, 270 degrees.

Clicking on the F(x) icon will take you to a large expression editor.

Code-11

Go to the properties of the obCatBarcode component.

The text written in the barcode editor in the Code field will be transferred to the Expression field. If Expression is empty, the text from the Text field will be displayed.

In other words, the static text is written in the Text, and the Expression contains a calculated expression, including the value from the data source.

 

Creating a Code 11 barcode from Delphi / Lazarus / C++ Builder code

uses frxBarcod;
procedure TForm1.Button1Click(Sender: TObject);
var bc: TfrxBarcodeView;
begin
 bc := TfrxBarcodeView(frxReport1.FindObject('BarCode1'));
 {Set barcode type}
 bc.BarType := bcCode11;
 {Set a fixed barcode value}
 bc.Text := '123456';
 {Set the calculated barcode value}
 //bc.Expression := '<YourDatasetName."FieldName1"> + <YourDatasetName."FieldName2">';
 {Set whether to calculate the checksum and add it to the end of the barcode}
 bc.CalcCheckSum := False;
 {Set the scale at which the barcode will be displayed}
 bc.Zoom := 2;
 {Set the rotation angle of the barcode. It can take values 0, 90, 180, 270}
 bc.Rotation := 0;
 {Specify whether to set the width of the barcode depending on its content.}
 {If set to False, Zoom property will be set to keep the barcode width fixed}
 bc.AutoSize := True;
{Set the color of the barcode background}
 bc.Color := clNone;
 {Set the color of the barcode lines}
 bc.ColorBar := clBlack;
 {Set whether to display text at the bottom of the barcode}
 bc.ShowText := True;
 frxReport1.ShowReport();
end;

We have added this simple barcode to the rich functionality of FastReport VCL. Although it is not so popular due to its density, some of our clients are happy to use it in their reports. Subscribe to our news and you will never miss an article about new features of our products!

November 01, 2024

New Features of the FastReport VCL Editor

We are considering new features of the report editor: extension lines, highlighting of intersecting objects, updated report and data trees.
October 30, 2024

Using Styles When Creating Reports in FastReport VCL

The article discusses one of the new features of FastReport VCL — the use of styles and style sheets.
October 28, 2024

How to Set Up WSL 2 for Working with FastReport and FastCube

In this article, we will explore how to set up WSL 2 for working with FastReport and FastCube components in Lazarus for Linux.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2024 Fast Reports Inc.