以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]如何根据编号自动生成条形码,存储条形码图片  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=160557)

--  作者:宇哥
--  发布时间:2021/2/5 21:57:00
--  [求助]如何根据编号自动生成条形码,存储条形码图片
如何根据“编号”列(字符型),自动生成条形码到“条形码”列,要求条形码产生的图片文件名为“编号.jpg”
编号列=字符型
条形码列=图片型
表属性 DataColChanged 事件: 

Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Dim cdt As DataTable = DataTables("主表")
Dim cdc As DataCol = cdt.DataCols("编号")
Dim ii As Integer = -1
For i As Integer = 0 To DataTables("主表").DataRows.Count - 1
    If e.DataRow("编号") = Nothing
        Bar.Code = e.DataRow("编号")
        Bar.BarRatio = 0.3
        Bar.BarHeight = 8
        Bar.DisplayChecksum = False
        Bar.DisplayStartStopChar = False
        \'Bar.SaveImage("images\\" & cdc &".jpg")
        e.DataRow("条形码").FileName= GetImage("images\\" & cdc &".jpg")
    Else
        
    End If
    ii = i
    Exit For
Next
[此贴子已经被作者于2021/2/5 22:00:29编辑过]

--  作者:宇哥
--  发布时间:2021/2/6 14:26:00
--  
哪位可以不吝赐教
--  作者:有点蓝
--  发布时间:2021/2/7 9:42:00
--  
先看看:http://www.foxtable.com/webhelp/topics/1522.htm

If e.DataCol.Name = "编号" Then
    
If e.DataRow.IsNull("编号")=false Then
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
Bar.Code = e.DataRow("编号")
        Bar.BarRatio = 0.3
        Bar.BarHeight = 8
        Bar.DisplayChecksum = False
        Bar.DisplayStartStopChar = False
        Bar.SaveImage("images\\" & e.DataRow("编号") &".jpg")
        e.DataRow("条形码")= e.DataRow("编号") & ".jpg"
    End If
End If

--  作者:宇哥
--  发布时间:2021/2/7 10:36:00
--  
 犹如醍醐灌顶!既给了鱼又给了渔,感谢!