This document describes how to use bar codes in reports, lists the main properties required to create bar codes of different types, and explains how to prevent errors that are most frequently encountered when creating bar codes.
The bar code generator that is provided by XtraReports is also available as a standalone Windows Forms control: BarCodeControl.
After creating the bar code, click its smart tag to access its main properties.
To specify the bar code type (symbology), use the XRBarCode.Symbology property.
After specifying the symbology, you can customize the type-specific options of the bar code, which are listed in the Properties window under the Symbology property.
In code, use the Symbology property to assign the bar code generator (the BarCodeGeneratorBase class descendant) that is appropriate to this bar code type.
To specify the bar width (a bar code's resolution), use the following options:
The following are some additional bar code options:
The following section explains how to work around the most frequently encountered errors related to the incorrect use of bar codes.
The following error message is shown in place of the bar code if the control's dimensions are too small to fit the bar code with its specified resolution.
To get rid of this error, enable the XRBarCode.AutoModule property and/or increase the bar code's dimensions.
The following exception appears when the data supplied to a bar code contains characters that are not supported by this bar code type.
To avoid this error, supply data that applies to a particular bar code specification.
After specifying bar code settings, you can make sure that the resulting bar code will be properly rendered in a document by calling the XRBarCode.Validate method (e.g., in the XRControl.BeforePrint event handler).