UPC EAN Barcodes in SQL Server Reporting Services (SSRS)

How to create barcodes in SSRS

  • BarCodeWiz UPC EAN Fonts can be used to create barcodes in SSRS. Follow the steps below to add barcodes to your own report.
UPC EAN barcodes in SSRS - preview

Step 1. Create a new report

  • Click on File > New > Blank Report
Create a new report SSRS

Step 2. Connect your Data Source

  • In this example, we are using a simple 3 column items data set.
Add Code 128 source code to the report

Step 3 Add BarCodeWiz Code to the Report

  • Right-Click on the blue report background and select Report Properties
Open window
  • Locate the text file containing the code. The default location of the text file is:
    Documents\BarCodeWiz Examples\UPC EAN Barcode Fonts\Report Builder\code.txt
Locate text file with source code
  • Copy the contents of the file into the Custom Code window of Report Properties and click on the Refrences tab.
Copy contents of the file

Step 4. Add a Reference to System.Drawing.dll

  • Under Report Properties, click on References > Add
  • Locate System.Drawing.dll. Default windows location is under:
    C:\Windows\Microsoft.NET\Framework\v2.0.50727\
Add a new Reference

Step 5. Insert Table into the report

  • Under the Insert tab in the Data Regions section, click on Table > Insert Table
  • Click and drag to desired dimensions
Ellipsis button
  • Drag non-barcode dataset items into the header columns on the table.
    In this example, we used item_name and item_price for the first two columns.
  • Then, under the Insert tab in the Report Items section, insert an Image into the table cell.
    Note: the header text for item barcode was manually typed in on the third column in our example.
  • Once the image control is inserted, right-click and select Image Properties.
Locate the Reference
  • In the General tab of Image Properties:
  • Select Database as the image source.
  • Select image/png as the MIME type
  • Under Use this field, select the Fx button and enter the following expression:
    =Code.EAN13Bytes(Fields!item_barcode.Value, 1)
  • Click OK.
Connect to Data Source

Step 6. Finalize and generate report

  • Under the Home tab, in the Views section click Run to generate the report.
Insert a new table into the report
  • The final result
Add an image for barcode

UPC EAN Fonts Functions in SSRS

UPCABytes(barcode as String, height as Integer)

  • Encodes the barcode in UPC-A format.
  • The function parameters are:

    barcode: String value with the barcode data to encode. Must be 11 or 12 digits. Enter 11 digits to have the check digit added automatically. Also accepts 13, 14, 15, or 17 digits for +2 and +5 Add-on

    height: Integer value indicating which version of the font height should be selected. Valid values are from 1 to 6.

UPCEBytes(barcode as String, height as Integer, showText as Boolean)

  • Encodes the barcode in UPC-E format.
  • The function parameters are:

    barcode: String value with the barcode data to encode. Must be 7 or 8 digits. Enter 7 digits to have the check digit added automatically. Also accepts 9,10, 12, or 13 digits for +2 and +5 Add-on

    height: Integer value indicating which version of the font height should be selected. Valid values are from 1 to 6.

EAN13Bytes(barcode as String, height as Integer, showText as Boolean)

  • Encodes the barcode in EAN-13 format.
  • The function parameters are:

    barcode: String value with the barcode data to encode. Must be 12 or 13 digits. Enter 12 digits to have the check digit added automatically. Also accepts 14, 15, 17, or 18 digits for +2 and +5 Add-on

    height: Integer value indicating which version of the font height should be selected. Valid values are from 1 to 6.

EAN8Bytes(barcode as String, height as Integer, showText as Boolean)

  • Encodes the barcode in EAN-8 format.
  • The function parameters are:

    barcode: String value with the barcode data to encode. Must be 7 or 8 digits. Enter 7 digits to have the check digit added automatically.

    height: Integer value indicating which version of the font height should be selected. Valid values are from 1 to 6.