다음을 통해 공유


Code 128 Barcode in SSRS (Open Source)

  1. Thanks to Chris Wuestefeld first of all. Check the Link below: http://www.codeproject.com/Articles/14409/GenCode-A-Code-Barcode-Generator
  2. Download the Source Code and demo files in code project.
  3. After downloading, extract the source code which is downloaded http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc3.png
  4. Right click on the Sample Project, Open the Folder and check the GenCode128.dll will be used in SSRS Reports. http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc4.png
  5. Copy the GenCode128.dll in SQL Server to register in the SQL Server.
  6. First of all GenCode128.dll which done localization, into the location: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies ". Reference: http://stackoverflow.com/questions/13379804/could-not-load-file-or-assembly-in-reporting-services http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc5.png
  7. After Registering the GenCode128.dll successfully in SQL Server.
  8. Open the Command Prompt with administrator privileges, Type "iisreset" to reset the IIS in SQL Server Machine.
  9. Now it's time to implement in the Barcode Reporting, Open the SQL Data Tools(Visual Studio 2010 Shell) and Create new Project http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc6.png
  10. After create new Project, Right click add new item http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc7.png
  11. Select the Report http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc8.png
  12. After adding the report, it's time to implement the barcode in reporting. Right click and select the "Report Properties". http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc9.png
  13. Select the References and add the assemblies, which is registered in "C:\Program Files (x86)\M`icrosoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies" and select the GenCode128.dll and System.Drawing which is .Net Framework 2.0. http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc10.pnghttp://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc11.png
  14. After adding the Reference, its time to add the code which will generate the Barcode in SSRS. Note : Code which is running is VB.NET for SSRS. Paste this Code: Function PaintBox(ByVal level As String) As System.Drawing.Bitmap Dim objBitmap As System.Drawing.Bitmap objBitmap = GenCode128.Code128Rendering.MakeBarcodeImage(level, 1, True) Return objBitmap End Function

Function PaintBoxBmp(ByVal level As String) As Byte() Dim bmpImage As System.Drawing.Bitmap bmpImage = PaintBox(level) Dim stream As System.IO.MemoryStream = New IO.MemoryStream Dim bitmapBytes As Byte() bmpImage.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp) bitmapBytes = stream.ToArray stream.Close() bmpImage.Dispose() Return bitmapBytes

End Function

http://crmandsilverlight.files.wordpress.com/2015/01/010915_1929_code128barc12.png