Foxtable(狐表)用户栏目专家坐堂 → [求助]条码打印


  共有2754人关注过本帖树形打印复制链接

主题:[求助]条码打印

帅哥哟,离线,有人找我吗?
lwj396086371
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:205 积分:1468 威望:0 精华:0 注册:2013/2/1 21:25:00
[求助]条码打印  发帖心情 Post By:2015/4/1 10:59:00 [只看该作者]

我的条码纸是65*25,一行只打印一个条码,现在我的“条码表”有三行数据,预览的时候只显示一行,代码如下:

Dim doc As New PrintDoc
doc.PageSetting.Width = 65 '纸张宽度为65毫米
doc.PageSetting.Height = 25 '纸张高度为25毫米
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Dim t As Table =  Tables("条码") '指定数据来源表
For i As Integer = t.TopPosition To t.BottomPosition
    Dim r As Row =t.Rows(i)
    Bar.Code = r("条码")
    Bar.HumanReadableText = r("生成条码")
    Bar.CodeAlignment = Barpro.Alignment.BelowLeft
    Bar.Font = New Font("Consolas",11)
    Bar.BarWidth = 0.25
    Bar.BarHeight = 10
    Bar.Text = r("型号")
    Bar.TextFont = New Font("OCR-B-Seagull",CSng(10.5),FontStyle.Bold)
    Bar.TextAlignment = Barpro.Alignment.AboveLeft
    Bar.TopMargin = 1
    Bar.BottomMargin = 1
    Bar.Code128CharSet = Barpro.Code128.B
    rg = new prt.RenderGraphics
    bar.DrawOnCanvas(rg.Graphics,0,0,1)
    rg.x=9
    rg.y=3
    'rg.Style.Spacing.All = 2
    Doc.Body.Children.Add(rg)
Next
Doc.PrinterName = "TSC TTP-244 Pro"
''Doc.print
Doc.Preview()

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/4/1 11:07:00 [只看该作者]

 Dim doc As New PrintDoc
doc.PageSetting.Width = 65 '纸张宽度为65毫米
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Dim t As Table =  Tables("条码") '指定数据来源表
Dim idx As Integer = 0
For i As Integer = t.TopPosition To t.BottomPosition
    Dim r As Row =t.Rows(i)
    Bar.Code = r("条码")
    Bar.HumanReadableText = r("生成条码")
    Bar.CodeAlignment = Barpro.Alignment.BelowLeft
    Bar.Font = New Font("Consolas",11)
    Bar.BarWidth = 0.25
    Bar.BarHeight = 10
    Bar.Text = r("型号")
    Bar.TextFont = New Font("OCR-B-Seagull",CSng(10.5),FontStyle.Bold)
    Bar.TextAlignment = Barpro.Alignment.AboveLeft
    Bar.TopMargin = 1
    Bar.BottomMargin = 1
    Bar.Code128CharSet = Barpro.Code128.B
    rg = new prt.RenderGraphics
    bar.DrawOnCanvas(rg.Graphics,0,0,1)
    rg.x=9
    rg.y = 3 + 25*idx
    'rg.Style.Spacing.All = 2
    Doc.Body.Children.Add(rg)
    idx += 1
Next
Doc.PrinterName = "TSC TTP-244 Pro"
''Doc.print
Doc.Preview()

 回到顶部
帅哥哟,离线,有人找我吗?
lwj396086371
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:205 积分:1468 威望:0 精华:0 注册:2013/2/1 21:25:00
  发帖心情 Post By:2015/4/1 11:23:00 [只看该作者]

还是不行,只显示一个条码
图片点击可在新窗口打开查看此主题相关图片如下:条码.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/4/1 11:25:00 [只看该作者]

 你的代码,是选中多少行,就打印多少个啊。

 

 你用鼠标选中几行看效果。不然就改代码

 

 Dim doc As New PrintDoc
doc.PageSetting.Width = 65 '纸张宽度为65毫米
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Dim t As Table =  Tables("条码") '指定数据来源表
Dim idx As Integer = 0
For i As Integer = 0 To t.Rows.count - 1
    Dim r As Row =t.Rows(i)
    Bar.Code = r("条码")
    Bar.HumanReadableText = r("生成条码")
    Bar.CodeAlignment = Barpro.Alignment.BelowLeft
    Bar.Font = New Font("Consolas",11)
    Bar.BarWidth = 0.25
    Bar.BarHeight = 10
    Bar.Text = r("型号")
    Bar.TextFont = New Font("OCR-B-Seagull",CSng(10.5),FontStyle.Bold)
    Bar.TextAlignment = Barpro.Alignment.AboveLeft
    Bar.TopMargin = 1
    Bar.BottomMargin = 1
    Bar.Code128CharSet = Barpro.Code128.B
    rg = new prt.RenderGraphics
    bar.DrawOnCanvas(rg.Graphics,0,0,1)
    rg.x=9
    rg.y = 3 + 25*idx
    'rg.Style.Spacing.All = 2
    Doc.Body.Children.Add(rg)
    idx += 1
Next
Doc.PrinterName = "TSC TTP-244 Pro"
''Doc.print
Doc.Preview()


 回到顶部