Barcode Rendering Framework - SQL Server 2008 Reporting Services Integration
The SSRS2008 barcode integration is basically a SSRS Custom Report Item (CRI).
A CRI is created in two parts;
- CRI runtime component
- CRI design-time component
Both runtime and design-time components are used from Visual Studio when authoring a report whereas only the runtime components are needed by SSRS itself.
The design-time experience in this beta build of BRF CRI is intentionally simple... There are no property type converters or UI type editors to enhance the design-time experience for example - it's just plain and dirty.
After installing the plugin (using the installer provided), create a SSRS report. You will need to add the barcode design time control to your toolbox (the assembly you are looking for is called Zen.Barcode.SSRS.Design and it is installed to %program files%\Microsoft
Visual Studio 9\Common7\IDE\Private Assemblies.
Now you can drag a barcode onto your report. For best results, set the bar height first to say 35, then select a symbology (say code128) and the rest of the bar metrics will be automatically populated.
The Text property can contain a fixed value (say 1234) or it can reference an SSRS expression (say =Fields!MyField.Value).
NOTE: If you set the Text value to an expression the designer will render it as though the string is a barcode...
At any time clicking the Preview tab will run the report locally and if all is well, show the report with barcodes.
Currently the rendering logic will place the barcode in the centre of any region you have created for the barcode on the report surface.
TODO: Add information pertaining to changes made to configuration files during install
If you need to show barcodes in the header or footer of your report (and you have installed Barcode Render v22.214.171.124 or higher) then read on…
To show barcodes in the header or footer region requires a small work-around since SSRS does not support placing custom report item objects in the header or footer. This means you have to call into the barcode rendering DLL directly from the report to get
the barcode image and then enlist the help of a standard SSRS Image control to present the data on the report – easy! Here how you do it…
1. Setup report references and classes
The Zen Barcode DLLs are located in the SSRS bin folder and you will also need to add a reference to System.Drawing to get things to work nicely.
Note: The assembly version number has changed with v3…
2. Setup the report code block to setup the barcode builder when given a barcode
This code takes the barcode text and sets up the symbology needed by the reported (in this example we’re using Code-128) and then gets the barcode image data from the barcode builder.
3. Place image control on the header of your report
Add the image control dragging from the toolbox, set the MIMEType to image/bmp, set the Source to
Database and finally set the Value to the following;
Feel free to swap the value InternalReference to the field you want represented as a barcode…
NOTE: If you reference a DataSet field here then you will have to add a Text Box control that references the same field otherwise SSRS will complain when you attempt to view or preview the report (that’s why the example shown has a Text Box underneath.)