1、模板那里,需要引用两个图片,一个是 [&&BarCode26.gif],一个是 [&&BarCode27.gif]
2、修改代码如下
If e.Book.TempLate = "条形码打印清单" Then
If e.region = "条形码单列打印" Then
If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条形码A列") Then '如果是空行或者Lot列为空
Dim img As New System.Drawing.Bitmap(1,1) '生成一个空白图片
img.Save(ProjectPath & "Images\BarCode26.gif")
Else '否则生成条形码图片
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Bar.Code = e.DataRow("条形码A列")
Bar.BarRatio = 0.3
Bar.BarHeight = 8
bar.SaveImage(ProjectPath & "Images\BarCode26.gif",300)
Bar = New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.Code = e.DataRow("条形码B列")
Bar.QuietZoneWidth = 2
bar.SaveImage(ProjectPath & "Images\BarCode27.gif",300)
End If
End If
End If