更专业的条形码功能

专业报表虽然提供了一个RenderBarCode类型用于打印条形码,但是功能有限,且只能打印几种常见的一维码,对于二维码束手无策。
我们可以用BarCodeBuilder类型来为专业报表实现更专业的条形码打印功能。

示例一

生成一个简单的条码:

Dim doc As New PrintDoc
Dim
rg As New prt.RenderGraphics
Dim
Bar As New BarCodeBuilder
Bar
.Symbology = Barpro.Symbology.Code39
bar
.Code = "12345678"
rg
= new prt.RenderGraphics
bar
.DrawOnCanvas(rg.Graphics,0,0,1)
Doc
.Body.Children.Add(rg)
Doc.Preview()

示例二

根据某表的内容,批量打印二维码:

Dim doc As New PrintDoc
Dim
rg As prt.RenderGraphics
Dim
Bar As New BarCodeBuilder
Bar
.Symbology = Barpro.Symbology.QRCode
Doc
.Stacking = prt.StackingRulesEnum.InlineLeftToRight
For Each
r As Row In Tables("A").Rows
   
bar.Code = r("第一列")
   
rg = new prt.RenderGraphics
   
bar.DrawOnCanvas(rg.Graphics,0,0,1)
   
rg.Style.Spacing.All = 3
   
Doc.Body.Children.Add(rg)
Next

Doc
.Preview()

 

 


本页地址:http://www.foxtable.com/webhelp/topics/2093.htm