IDAutomation.com, Inc., Computers Hardware, Software & Services, Tampa, FL Contact IDAutomationView your cart in the IDAutomation Store  
Loading
Home > Font Encoders > Microsoft Reporting Services SQL Server Reporting Services Barcode (SSRS) Tutorial

SSRS Barcode Generation with the .NET Assembly

SSRS Barcode Font RepresentationThis SSRS barcode font tutorial provides a walkthrough of steps for generating barcodes in Microsoft SQL Server Reporting Services and Visual Studio .NET environments. This can be accomplished by using IDAutomation barcode fonts in conjunction with an IDAutomation .NET Barcode Font Encoder Assembly.

Compatibility
  • Visual Studio .NET 2003, 2005, 2008, 2010, and 2012
  • SQL Server Reporting Services (SSRS) 2000, 2005, 2008, 2008R2, and 2012
  • Microsoft .NET Framework 2.0 (minimum)

SSRS Barcode Font Tutorial Overview

IDAutomation includes the .NET Assembly with the purchase of a Developer License for any of our barcode font packages. The .NET Barcode Font Encoder Assembly & DLL file used in this tutorial formats the data-to-encode specifically for use with IDAutomation's barcode fonts, and is designed to meet the specifications of the symbology laid out by the AIM and/or ANSI standards.

This example will demonstrate how to build an SSRS report based on the "Customers" table of the Ice Cream Company database using the IDAutomation.NETAssembly.dll and Code 128 Barcode Font package. The report will include the database fields of Ice_Cream_ID and Ice_Cream_Type. A custom field will be added to the report, which will provide a Code 128 barcode representation of the Ice_Cream_ID.

SSRS Barcode Font Tutorial Applications and Components
.NET Barcode Assemblies Support Barcode Symbologies Class Name / Function Name
IDAutomation.NETAssembly.dll * Code 128, Code 39, Interleaved 2 of 5, UPCa, UPCe and other supported Linear (1D) barcode symbologies. Class Name:
IDAutomation.NETAssembly.FontEncoder
Function Name: See Description **
Universal Font Package Class Name:
IDAutomation.NetAssembly.UniversalFontEncoder
Function Name: See Description **
IDAutomation.IntelligentMail.dll * Intelligent Mail/IMb Class Name: IDAutomation.IntelligentMail.IntelligentMail
Function Name: FontEncode
IDAutomation.DataBarFontEncoder.dll * DataBar, DataBar Limited, DataBar Expanded, DataBar Expanded Stacked, DataBar Stacked, DataBar Truncated, DataBar Omni Directional Class Name: IDAutomation.Databar.Databar
Function Name: See Description **
IDAutomation.Aztec.dll Aztec Font & Encoder Advantage Package Class Name: IDAutomation.Windows.Forms.AztecBarcode.AztecBarcode
Function Name: FontEncode
IDAutomation.DataMatrix.dll Data Matrix Font & Encoder Advantage Package Class Name: IDAutomation.Windows.Forms.DataMatrixBarcode.DataMatrixBarcode
Function Name: FontEncode
IDAutomation.PDF417.dll PDF417 Font & Encoder Advantage Package Class Name: IDAutomation.Windows.Forms.PDF417Barcode.PDF417Barcode
Function Name: FontEncoder
IDAutomation.QRCode.dll QR Code Font & Encoder Package Class Name: IDAutomation.Windows.Forms.QRCodeBarcode.QRCodeBarcode
Function Name: FontEncode

* A demo of the Linear DLL's are included in the .NET Assembly Font Encoder Download. The 2D versions are included in their respective Demo Packages.
** Includes functions for various barcode symbologies.

Reporting Services SSRS Barcode Tutorial

Set Up & Installation
  1. Download and install the purchased or demo barcode fonts on the printers, servers or computers where the barcode will be utilized. This example uses the Code 128 Font Package.

  2. Download the .NET Font Encoder Assembly. This example uses the licensed version of the linear IDAutomation.NETAssembly.dll, which will be included in the Font Encoder Developer Tools Zip File for those that purchase a Developer's License and above.
     
  3. Copy the IDAutomation.NETAssembly.dll to the following directories:
    %ProgramFiles%\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies
    %Program Files%\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin
    NOTE: For assistance on how to configure this solution for your environment, review Microsoft's Deploying a Custom Assembly article.

  4. Navigate to
    %ProgramFiles%\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies
    and open the RSPreviewPolicy configuration file. The RSPreviewPolicy sets the Visual Studio to display the barcode during a Preview. If FullTrust is not granted to the codegroups in this file, then the error message "That assembly does not allow partially trusted callers" will appear during preview. Change the PermissionSetName from Execution to FullTrust.

    In the RSPreviewPolicy.config file, place this code after the first CodeGroup:
    <CodeGroup
    class="FirstMatchCodeGroup" version="1" PermissionSetName="FullTrust" Name="IDAutomationNETAssembly" Description="This code group grants IDAutomationNETAssembly.dll Full Trust permission and allow Preview in Visual Studio."> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\IDAutomation.NetAssembly.dll"/> </CodeGroup>
  5. Navigate to
    %ProgramFiles%\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer
    and open the rssrvpolicy configuration file.

    In the rssrvpolicy.config file, place this code after the first CodeGroup:
    <CodeGroup
    class="UnionCodeGroup"
    version="1"
    PermissionSetName="FullTrust"
    Description="This code group grants IDAutomationNETAssembly.dll Full Trust permission.">
    
    <IMembershipCondition class="UrlMembershipCondition"version="1"
    Url="C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting 
    Services\ReportServer\bin\IDAutomationNETAssembly.dll" />
    </CodeGroup>
  6. Reboot the server or servers that are running the Visual Studio and SQL Server Reporting Services applications.
Tutorial
  1. If adding the custom assembly to an existing report, skip to Step 19. Otherwise select File - New - Project.

  2. In the Templates, select Business Intelligence - Reporting Services - Report Server Project Wizard.
    Select Business Intelligence Project in the SSRS Report.

  3. Name the project and select OK.

  4. In the Select the Data Source window, select New data source, create a Name, set the Type of data source, and choose Edit.

  5. In the Connection Properties, select the Server name; log onto the server; select or attach the database, and select OK.
    Setting Connection Properties in the SSRS Report.

  6. To verify the connection is successful, select Test Connection. The test results should display Test connection succeeded. Choose OK.

  7. Select Next.

  8. In the Design the Query, select Query Builder.
    Select Query Builder in the SSRS Report.

  9. Select the Add Table icon.
    Select Query Designer in the SSRS Report.

  10. Choose the Table and click Add. Select Close.
    Add a Table to the SSRS Report.

  11. Place a checkmark in the box in front of the fields to include on the report and select OK.
    Check the items to appear on the report from the table.

  12. Select OK again.

  13. Once the query string is set, select Next.

  14. Select the report type and choose Next.

  15. In the Design the Table window, move the Available fields to the Displayed fields text area by left-clicking the field and select Details>. Select Next.
    Select the Fields to Display on the SSRS Report.

  16. Choose the table style for the report and select Next.

  17. Set the Report Server Version, Report Server, Deployment Folder, and choose Next.

  18. Create a name for the report and choose Finish to complete the wizard.

  19. To activate the Report menu in the VS .NET IDE, left-click on the body of the report. Select Report - Report Properties.
    Activate the Report Menu.

  20. Select References. In the Add or Remove assemblies, select Add and then select the ellipsis button ( ellipsis ).

  21. Select the Browse tab, choose the IDAutomation.NETAssembly.dll, and select OK.

  22. In the Add or Remove classes, set the Class Name containing the data-encoding functions. For the IDAutomation.NETAssembly.dll, use IDAutomation.NETAssembly.FontEncoder. This value is pulled directly from the assembly file.

  23. Set an instance name and select OK. This tutorial uses clsIDAutomationBarcode. (Additional DLL Required for 2D)
    Set References to Assemblies and Classes in the SSRS Report.

  24. To add an encoded data field to the report, right-click the last column in the table and select Insert Column - Right. Name the field "Barcode."
    Insert a Column for the Barcode Field in the SSRS Report.

  25. Right-click the empty area below the Barcode field and select Expression.
    Create an Expression in the SSRS Report.

  26. Enter =Code.clsIDAutomationBarcode.Code128(Fields!Ice_Cream_ID.Value).
    The format of the expressions is: =Code.InstanceName.FunctionName(parameter) where: (2D Specific Expressions)
    1. Code is a global module for processing custom code requests,
    2. InstanceName is the instance of the class variable assigned,
    3. FunctionName is one of the functions available and the parameter is the data that needs to be encoded into a barcode.
      Enter the formula in the SSRS Report.

  27. Select OK.

  28. Click the Preview tab to ensure that the function is returning data. Depending on the barcode type encoded, the data may appear as strange characters, numbers, or uppercase letters. This is the encoded data.
    Verify the Data is Being Encoded in the Print Preview.

  29. Return to Design view. In the Expression, right-click and select Text Box Properties. Choose Font and set the font to IDAutomationC128M (or the demo font IDAutomationSC128M). Select OK.

  30. Preview the SSRS report.
    Preview the Report to Display the SSRS Barcode Font.
  31. To deploy the solution to the Report Server, select Build - Deploy Solution. For guidance on how to set up deployment, view Microsoft's How to Set Deployment Properties article.

2D SSRS Barcode Additional Setup Requirements and Examples

System DLL Required

Because each 2D Barcode .NET DLL is built as a .NET Forms Control, a reference to the the System.Windows.Forms.dll is required. After Step 23, choose Add and then select the ellipsis button ( ellipsis ). Select the .NET tab, choose the System.Windows.Forms.dll, and select OK.

Select the System.Windows.Forms.dll in the SSRS Report.

Function Names and Recommended Encoding Parameters for SSRS Barcode Generation

Step 26 explains how to input a global module, create an instance of the class, and enter the function name. The encoder function in each 2D .NET DLL composes of several parameters that require values. The recommended settings for each symbology's function is listed under the symbology name.

Aztec:
=Code.InstanceName.FontEncode(DataToEncode,false,0,false)

Data Matrix:
=Code.InstanceName.FontEncode(DataToEncode,false,0,0)

PDF417:
=Code.InstanceName.FontEncoder(DataToEncode,0,0,0,false,PDF417Barcode.PDF417Modes.Text,true)

QRCode:
=Code.InstanceName.FontEncode(DataToEncode,false,EncodingModes.Alphanumeric,Versions.Auto,ErrorCorrectionLevels.H)

NOTE: DataToEncode is the data field to format as the barcode.

SSRS Barcode Technical Support

Known SSRS Barcode Generation Issues

Additional Support Methods

Back to Top

 © Copyright 2014 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.