Add Bar Codes to Reports
- 2 minutes to read
This document explains how to use the XRBarCode report control.
Bar Code Options
To add a barcode to a report, drag the XRBarCode item from the DX.24.2: Report Controls Toolbox tab and drop it onto the report.
Specify the following barcode properties.
Set a barcode type (symbology).
Use the XRBarCode.Symbology property in the barcode control’s smart tag.Specify type-specific barcode options.
Set the XRBarCode.BinaryData property to encode a byte array into a barcode. Note that you can bind the BinaryData property to a data field. For more information on data binding, review the following help topic: Bind Report Controls to Data Using Expression Bindings.
Specify the barcode’s resolution:
- Use the XRBarCode.Module property to set a fixed bar width.
- Enable the XRBarCode.AutoModule property to automatically calculate the bar width according to barcode dimensions.
Specify the Text property. Note that you can bind the Text property to a data field. For more information on data binding, review the following help topic: Bind Report Controls to Data Using Expression Bindings.
- Use the XRBarCode.ShowText property to hide the barcode text.
- Use the XRBarCode.BarCodeOrientation property to rotate the barcode.
- Use the XRBarCode.PaddingInfo property to specify the bar code’s padding values.
Common Errors
The following table explains how to work around errors that may occur when the barcode is used incorrectly.
Error | Solution |
---|---|
Control boundaries are too small for the barcode | Enable the XRBarCode.AutoModule property and/or increase barcode dimensions. |
There are invalid characters in the text | Supply data that applies to barcode specification |
Invalid text format |
|
Binary data can’t be longer than the specified number of bytes | Pdf417/QRCode with binary data Decrease the encoded data quantity (the error specifies the possible maximum). |
Incompatible settings: logo size/module/error correction level |
Try one of the following actions:
|
To process these errors at runtime, call the XRBarCode.Validate method in the XRControl.BeforePrint event handler.