In this simple guide, you will learn how to use the Barcode DLL component in RDL reports.
Visual Studio (VS) 2005/2008/2010/2012/2013/2015/2017 or Business Intelligent Development Studio (BIDS) 2005/2008 or SQL Server Data Tools
Reporting Services 2005/2008/2008-R2/2012/2014/2016/2017 ANY Edition (Express, Workgroup, Web, Developer, Standard, Enterprise, Business or Datacenter)
In the following sample you'll create a Report Server Project which features barcode images by using Barcode DLL. This project will contain a simple RDL report displaying a List of products from Microsoft's AdventureWorks database sample http://msftdbprodsamples.codeplex.com/
This guide uses Visual Studio 2008 for reference but you can use the same approach if using a different Visual Studio version
Please follow up these steps:
Please ensure you've correctly configured Barcode DLL component
Open Visual Studio (or BIDS or SSDT) and create a new Report Server Project
With the Report Server project opened, add a new Data Source pointing to the AventureWorks database sample
Add a new Report item, name it to ProductList.rdlc, and enter the following SQL Statement:
SELECT ProductID, Name, ProductModel, CultureID FROM Production.vProductAndDescription WHERE (CultureID = N'en')
Now it's time to add a reference to Barcode DLL component and write a VB function for generating the barcode images.
Finally, select Code tab. When generating barcodes, you should know about what Barcode Symbology you need to encode. Most common symbologies are Code 39, Code 128, GS1-128, GS1 DataBar, EAN-13, UPC-A, Data Matrix, QR Code, etc. The barcode symbology is set up by using Symbology property of Barcode object. In this sample, you will use Code 128 barcode, a common symbology which can be used for encoding full ASCII strings. When using Barcode DLL component, you need to write a custom VB function for generating barcodes which will be later displayed by an Image item on the report. In this sample you will create a VB function called GetBarcode which accept a parameter called valueToEncode which, in general, is a field of the report's data source. Inside this function you will create an instance of Barcode class called objBarcode setting up some properties for generating the barcode image:
Refer to the full Barcode DLL API Documentation for further barcode image generation features!
Public Function GetBarcode(ByVal valueToEncode As String) As Byte()
Using objBarcode As New Neodynamic.ReportingServices.Barcode
'Set the value to encode
objBarcode.Code = valueToEncode
'Set the Code 128 Barcode Symbology
objBarcode.Symbology = _
Neodynamic.ReportingServices.Symbology.Code128
'Set the Bar's height to 0.5 in
objBarcode.BarHeight = 0.5F
'Enable AutoSize
objBarcode.AutoSize = True
'Generate the barcode image
Return objBarcode.GetBarcodeImagePng()
End Using
End Function
When you are ready for production, you must ensure that Barcode Professional is correctly configured and deployed to your Report Server! All steps for correctly deploying Barcode Professional DLL are stated in the Barcode DLL Deployment topic.
Tweet |
|
We provide best-in-class customer service and support directly from members of our dev team! If we are available when you contact us, you will get a response in few minutes; otherwise the maximum turnaround is 24hs in most cases.