Getting Started with the Barcode Report Item
This guide shows how to create and use the Telerik Reporting Barcode report item in reports.
- First, you will specify the type of the Barcode report item, configure its settings, and encode its value.
- Then, you will set the width of the Barcode elements and elaborate on the appearance of the report item.
After the completion of this guide, you will also be able to configure the Barcode with code and achieve the following result.
var encoder = new Telerik.Reporting.Barcodes.Code128AEncoder();
// Set any specific encoder settings...
encoder.ShowText = false; // The default value is true.
this.barcode1.Encoder = encoder;
this.barcode1.Angle = 90;
this.barcode1.BarAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
this.barcode1.Checksum = true;
this.barcode1.Module = Telerik.Reporting.Drawing.Unit.Point(3);
this.barcode1.Stretch = false;
this.barcode1.Value = "1234567890";
Dim encoder = New Telerik.Reporting.Barcodes.Code128AEncoder()
' Set any specific encoder settings...
encoder.ShowText = False 'The default value is True
Me.barcode1.Encoder = encoder
Me.barcode1.Angle = 90
Me.barcode1.BarAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left
Me.barcode1.Checksum = True
Me.barcode1.Module = Telerik.Reporting.Drawing.Unit.Point(3)
Me.barcode1.Stretch = False
Me.barcode1.Value = "1234567890"
Specifying the Barcode
-
To specify the type of the Barcode, use the
Encoder
property. After setting the desired encoder, you can further adjust the specific settings you require. -
Now, you need to encode the Barcode value through the
Value
property.Value
can be a static string or an expression which is evaluated at runtime.
Setting the Size and Appearance
-
You can now specify the width (size) of the Barcode elements. For the purposes of this guide, you will automatically calculate the width from the size of the item when the
Stretch
property is set totrue
. -
Align the bars to the edges of the item through the
BarAlign
property.Note that
BarAlign
is not applicable when theStretch
property is set totrue
. -
Rotate the Barcode through the
Angle
property.Note that when the angle is not divisible by 90 degrees and the
Stretch
property istrue
, the Barcode will be scaled down so that it fits into the item bounds. -
Include a checksum in the Barcode by using the
Checksum
property.Some symbologies either do not provide a checksum or the checksum is part of the symbology specification. In these cases,
Checksum
will have no effect.