Foxtable(狐表)用户栏目专家坐堂 → 打印标签产品标签,每个产品都需要打印,每行产品不同,而且每行数量也不仅仅是一个,请问老师如何打印标签


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

主题:打印标签产品标签,每个产品都需要打印,每行产品不同,而且每行数量也不仅仅是一个,请问老师如何打印标签

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


加好友 发短信
等级:幼狐 帖子:143 积分:1769 威望:0 精华:0 注册:2016/5/10 15:59:00
打印标签产品标签,每个产品都需要打印,每行产品不同,而且每行数量也不仅仅是一个,请问老师如何打印标签  发帖心情 Post By:2017/12/10 15:38:00 [只看该作者]

产品编号  产品名称  产品数量 
001        产品1       5
002        产品2       4
意思就是产品1连续打印5个,产品2 连续打印4,以此类推,请老师我如何处理呢
[此贴子已经被作者于2017/12/10 15:39:01编辑过]

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


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

参考代码

 

Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
Dim t As Table = Tables("表A")
For Each dr As Row In t.Rows
    For i As Integer = 1 To dr("第二列")
        Dim rt As New prt.RenderTable() '定义一个表格对象
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Width = 50 '表格宽度为50mm
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Cols(0).Width = 20
        rt.cells(0,0).Text = "姓名"
        rt.Cells(0,1).Text = dr("第一列")
        rt.Cells(1,0).Text = "职务"
        rt.Cells(1,1).Text = dr("第三列")
        rt.Cells(2,0).Text= "数量"
        rt.cells(2,1).Text = dr("第二列")
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Next
Next
Doc.Preview() '预览报表


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


加好友 发短信
等级:幼狐 帖子:143 积分:1769 威望:0 精华:0 注册:2016/5/10 15:59:00
  发帖心情 Post By:2017/12/11 9:01:00 [只看该作者]

谢谢老师,我想在里面假如条码,但是不知道错误在哪里,求助老师帮我看看
Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
Dim t As Table = Tables("表A")
For Each dr As Row In t.Rows
    For i As Integer = 1 To dr("第四列")
        Dim rt As New prt.RenderTable() '定义一个表格对象
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Width = 50 '表格宽度为50mm
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Cols(0).Width = 20
        rt.cells(0,0).Text = "姓名"
        rt.Cells(0,1).Text = dr("第一列")
        rt.Cells(1,0).Text = "职务"
        rt.Cells(1,1).Text = dr("第三列")
        rt.Cells(2,0).Text= "数量"
        rt.cells(2,1).Text = dr("第四列")
        Dim ra As New prt.RenderArea
        ra.Children.Add(rt)
        Dim rpar As New prt.RenderParagraph()
        Dim img As prt.RenderImage
        Dim Bar As New BarCodeBuilder
        Bar.Symbology = Barpro.Symbology.Code128 '条码规则
        Bar.BarRatio = 0.3
        Bar.BarHeight = 8
        Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
        bar.Code = dr("第三列")
        img = new prt.RenderImage
        img.Image = bar.GetImage
        Dim rm As New prt.RenderImage '定义一个条码图片对象
        rm.Image =bar.getimage '设置条码图片
        rm.Width = "Parent.Width" '宽度等于页面宽度
        rm.Height = "Auto" '高度由条码图片大小自动决定
        rm.Style.ImageAlign.StretchHorz = False '禁止条码图片水平拉伸
        rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '水平居中
        rm.X=2
        rm.y="Prev.Bottom + 2"
        ra.Children.Add(rm)
        '
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Next
Next
Doc.Preview() '预览报表

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


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

Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
Dim t As Table = Tables("表A")
For Each dr As Row In t.Rows
    For i As Integer = 1 To dr("第四列")
        Dim rt As New prt.RenderTable() '定义一个表格对象
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Width = 50 '表格宽度为50mm
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Cols(0).Width = 20
        rt.cells(0,0).Text = "姓名"
        rt.Cells(0,1).Text = dr("第一列")
        rt.Cells(1,0).Text = "职务"
        rt.Cells(1,1).Text = dr("第三列")
        rt.Cells(2,0).Text= "数量"
        rt.cells(2,1).Text = dr("第四列")
        Dim img As prt.RenderImage
        Dim Bar As New BarCodeBuilder
        Bar.Symbology = Barpro.Symbology.Code128 '条码规则
        Bar.BarRatio = 0.3
        Bar.BarHeight = 8
        bar.Code = dr("第三列")
        img = new prt.RenderImage
        img.Image = bar.GetImage
        rt.cells(3,0).text = "条码"
        rt.cells(3,1).RenderObject = img
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Next
Next
Doc.Preview() '预览报表

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


加好友 发短信
等级:幼狐 帖子:143 积分:1769 威望:0 精华:0 注册:2016/5/10 15:59:00
  发帖心情 Post By:2017/12/11 14:59:00 [只看该作者]

谢谢老师!


 回到顶部