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 bar code to a report, drag the XRBarCode item from the DX.20.1: Report Controls Toolbox tab and drop it onto the report.
Specify the following bar code properties.
Set a bar code type (symbology).
Use the XRBarCode.Symbology property in the bar code control’s smart tag.Specify type-specific bar code options.
Set the XRBarCode.BinaryData property to encode a byte array into a bar code.
Specify the bar code’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 the bar code’s dimensions.
Specify the XRControl.Text property or use the XRBarCode.ShowText property to hide the bar code’s text.
- Use the XRBarCode.BarCodeOrientation property to rotate the bar code.
- Use the XRBarCode.PaddingInfo property to specify the indent between bars and the bar code’s inner boundaries.
Common Errors
The following table explains how to work around the errors that may occur during incorrect bar code use.
Error | Solution |
---|---|
Control’s boundaries are too small for the bar code | Enable the XRBarCode.AutoModule property and/or increase the bar code’s dimensions. |
There are invalid characters in the text | Supply data that applies to the bar code’s 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.