Add MaxiCode Barcodes

Navigation:  How to Use It in Reporting Services >

Add MaxiCode Barcodes

Previous pageReturn to chapter overviewNext page

Follow the instructions to add the MaxiCode barcodes to the report.

 

1.In order to use the MaxiCode .NET control in the Reporting Services, please copy MW6.MaxiCode.dll to "C:\Program Files\Microsoft Visual Studio X\Common7\IDE\PrivateAssemblies" for 32 bit OS or "C:\Program Files (x86)\Microsoft Visual Studio X\Common7\IDE\PrivateAssemblies" for 64 bit OS, the X value is associated with Visual Studio .NET version, it might be 8 for .NET 2005, 9.0 for .NET 2008, 10.0 for .NET 2010, 11.0 for .NET 2012.

 

2.Right click the last column in the table, Select the "Insert Column to the Right".

Insert_Column_MC

3.Change the column title to the "MaxiCode Barcode".

Insert_Column_MC

4.On the "Report" menu, click the "Report Properties", click the "References" tab, click the two-dot button Three_Dots to open the "Add Reference" dialog.

A. Click the "Browse" tab, navigate to the location of the assembly MW6.MaxiCode.dll, select the file and click the "Add" button.

B. Click the ".NET" tab, highlight the assemblies "System.Drawing" and "System.Windows.Form", click the "Add" button.

C. Enter "MW6.MaxiCode.MaxiCodeNet" in the "Class name" box, enter "objMaxiCode" in the "Instance name" box to create an assembly object to use in the code to retrieve the MaxiCode barcode image byte stream.

 

5.On the same "Report Properties" dialog, click the "Code" tab, copy and paste the following code into this tab, this function is used to retrieve the MaxiCode barcode image byte stream, modify the code a bit to meet your application requirements.

 

Public Function GetImgStream(ByVal DataStr As String) As Byte()

 

 Dim ActualWidth As Integer, ActualHeight As Integer

 Dim ExtraWidth As Integer, ExtraHeight As Integer

 

 ' Message

 objMaxiCode.Data = DataStr

 

 ' Ratio

 objMaxiCode.Ratio = 1.0

 

 ' Mode

 objMaxiCode.Mode = 0

 

 ' Orientation

 objMaxiCode.Orientation = 0

 

 ' Handle Tilde Character?

 objMaxiCode.HandleTilde = True

 

 ExtraWidth = 60

 ExtraHeight = 80

 

 objMaxiCode.GetActualSize(True, Nothing, ActualWidth, ActualHeight)

 

 objMaxiCode.SetSize(ActualWidth + ExtraWidth, ActualHeight + ExtraHeight)

 

 Dim MS As System.IO.MemoryStream = New System.IO.MemoryStream

 Dim ImgStream As Byte()

 

 objMaxiCode.SaveAsMemory(MS, System.Drawing.Imaging.ImageFormat.Jpeg)

 

 ImgStream = MS.ToArray

 

 MS.Close()

 

 Return ImgStream

 

End Function


 

Aztec_Report_Code

6.Change the "BackgroundImage" property of the text box in the "MaxiCode Barcode" column to display the MaxiCode barcode image encoding ID value.

A. Source: Select the Database from the drop-down list, since the data will be pulled from a database field.

B. Value: Enter the string "=code.GetImgStream(Fields!ID.Value)", it will ask the report to use the GetImgStream() function to retrieve the MaxiCode barcode image byte stream for the ID field value of the database.

C. MIMEType: Select the image/jpeg from the drop-down list, since the MaxiCode barcode image is in jpeg format.

D. BackgroundRepeat: Select the NoRepeat from the drop-down list, so only one image will be placed in the text box.

Prop_1D_Text_MC

7.Click the "Preview" tab to check the MaxiCode barcode result.

8.For the reporting services deployment, check out Microsoft Knowledge Base article 842419 with the title "How to grant permissions to a custom assembly that is referenced in a report in Reporting Services", it is required to update the security settings of the .NET Framework to allow the MW6.MaxiCode.dll assembly to run properly.