| |
   
Morovia.com Home | Fonts | Components | Labeling | Library | Order | Forum  
   Search for

   Advanced Search
 

 

Home >> Fontware >> Support >> Report Service: Linear Barcode Fontware

Using Morovia Linear Barcode Font products in Microsoft Reporting Service

Note: the PDF version of this document is available at http://www.morovia.com/font/support/Morovia.SupportTools.ReportService.LinearFont.pdf. You can download the assembly (.Net 1.1) at http://www.morovia.com/font/support/Morovia.SupportTools.ReportService.LinearFont.zip, and project source code at http://www.morovia.com/font/support/Morovia.SupportTools.ReportService.LinearFont.src.zip.

Microsoft® SQL Server Reporting Service stores report definitions in the report server database. The report definitions are created using Report Definition Language(RDL), an XML format that describes each element in a report, including the data model, format, and expressions.

The most important part of the Reporting Service is the Report Designer, a tool for creating and publishing report definitions. Report Designer works with Microsoft Visual Studio 2003 and 2005, allowing developers to quickly design and deploy a report. For more information, see Microsoft documentation.

In order to use linear barcode fonts in Reporting Service, you need to download the support assembly from our web site. The assembly wraps several calls in managed code. Currently we release the code in a separate package. However, we expect to add the Reporting Service support into the future releases of Morovia Font Tools, which is included in every barcode font product.

1. Understanding how barcode font works

Only formatting the text with a barcode font won't produce a readable barcode. Most barcode formats require start and stop characters that tell the scanner where to start and stop. Additionally some barcode formats add checksum characters at the end to ensure the data integrity. To create a valid barcode, you need to call an encode function to get the barcode string (which adds start, stop and checksum characters), and format the latter with barcode font. You also need to determine which font and the font size for your application based on requirement.

2. Installing Support Assembly

The file name for the assembly is MoroviaFontRSPlugIn.dll. Copy this DLL to two folders below:

  • Report Designer folder [Program Files]Microsoft SQL Server\80\Tools\Report Designer.
  • Deploy folder [Program Files]Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin.

Note: the support assembly calls the Encoder COM object at the background. As a result, you still need to have the Encoder COM DLL available and registered on the computer that runs Reporting Service.

The assembly is compiled for .Net version 1.1. In order to support future .Net versions, the source code is attached. To download the source code, click here.

3. Functions Included

The name of functions are the same as the ones in other packages, such as Windows DLL version. All functions take one input argument (the data to be encoded), and return the barcode string. Characters that can not be encoded with the symbology selected are removed. If a symbology requires fixed length of input, the excess will be truncated if the input's length exceeds the required length, or zeroes are appended to the end of the input if too short.

If you are looking for barcode solutions other than Reporting Service, visit http://www.morovia.com/font/support/font-tool.asp.

Table 1. Functions supported

FunctionDetailsProduct to apply
Code39(text)Converts the input text into a Code 39 barcode string. Code39 Fontware
Code39Mod43(text)Converts the input text into a Code39 barcode string with Mod 43 check character.
Code39Ascii(text)Converts the input text into a Code39 extended symbol. This function should be used to format with a code39 font, not a Code39 full ASCII font. The text can be any combinations of ASCII characters. Note that the symbol generated is extended Code39 type, and the scanner must be configured to work in Code39 extended mode in order to read the symbol properly.
Code39Extended(text)Converts the input text into a extended code 39 string. It accepts any ASCII characters as input. The function should be used in conjunction with fonts from Code39(Full ASCII) fontware.Code39 (Full ASCII) Fontware
Code93(text)Converts the input text into a Code93 barcode string. It accepts any ASCII character input.Code39 Fontware
UPC_A(text)Converts the input text into a UPC-A barcode. Accepts input of 11 digits of numeric data.UPC/EAN/Bookland Fontware
UPC_E(text)Converts the input text into a UPC-E barcode. Accepts input of 6 digits of numeric data.
EAN13(text)Converts the input text into an EAN barcode. Accepts input of 12 digits of numeric data.
EAN8(text)Converts the input text into an EAN-8 barcode. Accepts input of 7 digits of numeric data.
Bookland(text)Converts an ISBN[a] string into a valid Bookland barcode string.
Postnet(text)Converts the input into a valid POSTNET barcode string with checksum. The function adds the start/stop frame bar, calculating the check digit and forms the correct symbol. This function can also be used to generate PLANET barcode string.U.S. Postal Fontware
USPS_EAN128(text)Used for 22 digit USPS special services labels such as delivery confirmation in EAN128. This function takes 19 digit input which is made up of the three parts: 2 digit service code, 9 digit customer ID and 8 digit sequential package ID. This function calculates the check digit (Mod10), add the application identifier 91 as required by the USPS standard, and format the data with EAN128 standard.
Code128A(text)Encodes data input with Code128 set A. Code128 set A encodes all capital letters and control characters.Code128 Fontware
Code128B(text)Encodes data input with Code128 set B. Code128 set B encodes all printable ASCII characters.
Code128C(text)Encodes numeric input with Code128 set C. Code128C achieves double density by combining two adjacent digits into one Code128 character.
Code128Ex(text)Encode any ASCII characters. It automatically shifts to another character set when the encoded character is not found in the current character set. This function should be used when mixed type of data are encoded, and the shortest barcode length is desirable.
EAN128Ex(text)Use this function for UCC/EAN-128 applications when you have already generated your MOD10 check digit if required. Input must be properly formatted. Search EAN128Ex in Morovia web site for more information.
SCC14(text)Accepts 13 digits input and generates the complete barcode sting for SCC14. This function calculates the SCC-14 check digit, adds AI 01 before the data, and encodes the whole in Code128C.
SSCC18(text)Accepts 17 digits input and generates the complete barcode string for SSCC18. This function calculates the check digit, adds AI 00, and encodes the data with Code128C.
RoyalMail(text)Converts the input into a valid UK royal mail barcode symbol with checksum. RoyalMail Fontware
Codabar(text)Converts the input into a valid Codabar symbol. The default start/stop characters are “A” and “B”.Codabar Fontware
Code25(text)Converts the input into a valid Code25 symbol. No check character is appended.Code25 Fontware
Code25Check(text)Converts the input into a valid Code25 symbol. Appends a check digit.
ITF25(text)Converts the input into a valid interleaved 2 of 5 barcode. No check digit is appended in this function.Interleaved 2 of 5 Fontware
ITF25Check(text)Converts the input into a valid interleaved 2 of 5 barcode. Appends a check digit.
MSIMod10(text)Converts the input into a valid MSI/Plessey symbol. Check digit is calculated based on Modulo 10 algorithm.MSI/Plessey Fontware
[a] 10-digit ISBN only. 13-digit ISBN uses EAN13 function.

4. Tutorial

In this tutorial, we add a column called barcode, which encodes the table column CustomerID in code128 format. Function Code128Ex is used to make barcodes as short as possible.

Procedure 1. Adding Code128 barcodes in Report Designer

  1. If you are adding barcodes into an existing project, skip to step 8. Now we start a new project. From Visual Studio, select File | New | Project. In the Project Types list box, click on Business Intelligence Projects. In the Templates box, select Report Project Wizard. Give the project a name and click OK.
  2. On the next screen, the Report Wizard asks for the data source. For simplicity we use the NorthWind database here, which is installed by default when installing SQL Server. You can type the connection string in the edit box directly, or you can have the wizard fill out for you by clicking the Edit... and select the appropriate choices from the Data Link Properties... dialog followed.

    After you finish constructing the connection string, click Next.

  3. At this step, the Report Wizard asks for a query string which will be used to populate the data set in the report. You can enter something like Select * from Customers; or you can click on Edit to pop up Query Builder to build the query. Make sure that you include CustomerID in the result set.
  4. Next, select the type of the report (tabular or matrix). Click Next.
  5. Now select the fields which will be displayed in the report. In the Available fields list box, use your mouse and CTRL key, select CustomerID, CompanyName and ContactName fields. Click on the Details< to move them to the right.
  6. Follow the instructions to complete the wizard.
  7. On the left side, switch to Solution View. Click on the Reports node to find the report just created. Double click on the report file name to bring it up to the right side. You will notice that three tabs appear on the right view, and the current position is at Layout tab. In the report, a filed name is expressed something like Fields!CustomerID.Value.
  8. We now start to add a new column to hold the barcodes. Click on the Company title once, the report responds by showing a header row on the top. Right click on the header row, and select Insert Column at the right. Give the new column a title “Barcode”.
  9. To define the value for the column, you need to tell that you are going to use the the assembly from Morovia. When the current view is the report, the Report menu is visible on top of Visual Studio. Select Report followed by Report Properties to bring up the Report Properties dialog.
  10. Click on the reference tab. In the top list box, click on the button. Click on Browse button once to locate the assembly: Morovia.SupportTools.ReportService.dll.
  11. Click on the General tab (or you can click >>Basic button to see a simple form. Move the cursor to the Value edit box. Enter the following:
    =Morovia.SupportTools.ReportService.FontEncoder.Code128Ex(Fields!CustomerID.Value) 

    The name is a little long. But we are working in the .Net world. Make sure that you entered them correct.

    The last part of the definition is the function name.

  12. Click on the Font tab. From the font list, select MRV Code128S. In this dialog you also have the opportunity to adjust barcode size by changing the font size. After you have done with font selection, Click OK to dismiss the dialog.
  13. Click on the Preview tab to view the report. The report should show as below:
  14. You need to make sure that there are sufficient spaces in the barcode field so that the complete barcode is visible. Unlike normal text a barcode can not wrap to the next line while retaining readability. If you found that some barcodes are wrapped into next line, go back to the Layout view and use your mouse to make appropriate adjustments.
  15. After you are satified with the report, click Build | Deploy Solution, to deploy the solution to the Report Server.

When there is an encoding error, for example, the backend COM dll is not found on your computer, the function returns an error message in the place of the barcode. To view the detail error message, format the barcode field with a text font (such as Arial).

5. Other Issues

Since the barcodes created are actually text formatted with barcode fonts, the fonts must be available on the client computer to view and print reports. Also you should note that Microsoft SQL Server Reporting Service does not embed fonts when exporting reports to PDF documents. As a result, in order to view and print exported PDF documents each client computer will also need to have the fonts available.

For more information about PDF rendering, see the related section in MSDN.

To top of page