現至下面網站下載 Zen.Barcode.Core.dll

http://barcoderender.codeplex.com/

 

將此dll加入專案中

報表對應Barcode的顯示欄位設定為Byte陣列

Public Class CWork
Public Property id As String
Public Property size As String
Public Property name As String
Public Property BarcodeImg As Byte()
End Class

 

 

資料結合報表SampleCode:

Dim list_Detail As New List(Of CWork)
For i = 0 To 2
Dim l_en As New CWork
l_en.id = i.ToString("000")
l_en.name = "555-" + l_en.id
Dim l_fy = BarcodeDrawFactory.Code128WithChecksum
'change biteArr
l_en.BarcodeImg = fybase.FormFy.FyUtility.imageToByteArray(l_fy.Draw("1234567" + i.ToString(), 20), Drawing.Imaging.ImageFormat.Jpeg)
l_en.size = "very big"
list_Detail.Add(l_en)
Next

'裝Report資料來源
ReportViewer1.Visible = True
Dim rds1 As ReportDataSource = New ReportDataSource("barcode", list_Detail)
ReportViewer1.LocalReport.DataSources.Clear()
'ReportView依照Report大小控制
ReportViewer1.SizeToReportContent = True
ReportViewer1.LocalReport.DataSources.Add(rds1)
ReportViewer1.LocalReport.Refresh()

 

結果如下:

barrrrrrrrrrrrrrr  

 

 

 

arrow
arrow
    全站熱搜

    Ryan 發表在 痞客邦 留言(0) 人氣()