在水晶报表中使用Code128条形码

1.将code128条码字体拷贝到C:\Windows\fonts下

下载地址是 http://download.csdn.net/detail/easyboot/9452777

2 .在水晶报表里的【字段资源管理器】的【公式字段】中新建一个公式字段例如我命名为Code128


3.在新建的字段单击鼠标右键 选择编辑 在报表自定义函数中新建函数如下图所示


代码如下所示

Function GetCode128B( inputData As string ) As String  
 
  Dim checksum    as  Number 
  Dim intPosition as  Number
  Dim ii          as  Number
  Dim strSpChr    as  String
 
  checksum = 104

    for  ii = 0 to Len(inputData)-1   
        intPosition = ii + 1  
        strSpChr = Mid(inputData, intPosition, 1)  
        
        if Asc(strSpChr) >= 32 then
          checksum = checksum + (Asc(strSpChr) - 32) * intPosition
        else
          checksum = checksum + (Asc(strSpChr) + 64) * intPosition
        end if
    next


    checksum = checksum mod 103


       if checksum < 95 then
          checksum = checksum + 32
       else
          checksum = checksum + 100
       end if


    GetCode128B ="Ì" +inputData+chr(checksum) +"Î"
  
 End Function


4.选中公式字段Code128 在函数参数中值 选择数据库字段



5.然后将字段Code128插入到报表中,并把报表中的字段修改为Code128即可


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值