Foxtable(狐表)用户栏目专家坐堂 → 条码批量打印不横向输出


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

主题:条码批量打印不横向输出

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


加好友 发短信
等级:幼狐 帖子:167 积分:1624 威望:0 精华:0 注册:2018/3/12 9:22:00
条码批量打印不横向输出  发帖心情 Post By:2020/6/15 13:33:00 [只看该作者]

Dim doc As New PrintDoc
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
'Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Bar.BarRatio = 0.3
Bar.BarHeight = 18




Bar.QuietZoneWidth = 2
Bar.AddCheckSum = False
Bar.DisplayChecksum = False


For Each r As Row In Tables("表A").Rows
    For i As Integer = 1 To 4   

    Dim ra As new prt.RenderArea
    Dim txt As new prt.RenderText
    
    
    txt.text = "XXXXXX公司"
  txt.X = 10
   txt.y = 5
    ra.children.add(txt)
   
 txt = new prt.RenderText
    txt.text = r("姓名")
   txt.x = 40
   txt.y =5
    ra.children.add(txt)
    
    
    bar.Code = r("tm")
    img = new prt.RenderImage
    img.Image = bar.GetImage
   img.x = 10
   img.y = 10

    ra.children.add(img)
    Doc.Body.Children.Add(ra)
    
Next
Next
Doc.Preview()



想要一行打印4个,现在输出的是一行一个,同一条码输出4次.

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110582 积分:562806 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/15 14:10:00 [只看该作者]


Dim doc As New PrintDoc
doc.PageSetting.Width = 220
doc.PageSetting.Height = 50
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
'Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Bar.BarRatio = 0.3
Bar.BarHeight = 18

Bar.QuietZoneWidth = 2
Bar.AddCheckSum = False
Bar.DisplayChecksum = False
Dim rm As prt.RenderEmpty '定一个空对象

For i As Integer = 0 To Tables("表A").rows.Count - 1 Step 4
    rm = new prt.RenderEmpty '定义一个新的空对象
    rm.BreakBefore = prt.BreakEnum.Page '打印前换页
    doc.Body.Children.Add(rm) '加入到报表中
    For j As Integer = 0 To 3
        If i+j < Tables("表A").rows.Count
            Dim r As Row = Tables("表A").rows(i + j)
            Dim ra As new prt.RenderArea
            ra.width = 50
            ra.X = j * 50 + 5
            ra.Y = 5
            ra.Style.Spacing.Right = 2 '设置标签之间的所有和上下间隔为2毫米
            ra.Style.Spacing.Bottom = 2
            ra.Style.Padding.All = 1 ' 标签内容距离边框为1毫米
            ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) '设置边框
            Dim txt As new prt.RenderText
            
            txt.text = "XXXXXX公司"
            txt.X = 10
            txt.y = 5
            ra.children.add(txt)
            
            txt = new prt.RenderText
            txt.text = r("第一列")
            txt.x = 40
            txt.y =5
            ra.children.add(txt)
            
            
            bar.Code = r("第二列")
            img = new prt.RenderImage
            img.Image = bar.GetImage
            img.x = 10
            img.y = 10
            
            ra.children.add(img)
            Doc.Body.Children.Add(ra)
        End If
    Next
Next
Doc.Preview()


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


加好友 发短信
等级:幼狐 帖子:167 积分:1624 威望:0 精华:0 注册:2018/3/12 9:22:00
  发帖心情 Post By:2020/6/15 15:55:00 [只看该作者]

如果我需要在A4纸张上打印多行。  
1 , 变更纸张高度   doc.PageSetting.Height = 350  
2,  For i As Integer = 0 To Tables("表A").rows.Count - 1 Step 4   在该语句下  添加什么语句,可以变更Y轴数据。


 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110582 积分:562806 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/6/15 16:02:00 [只看该作者]

Dim doc As New PrintDoc
doc.PageSetting.Width = 220
doc.PageSetting.Height = 350
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin = 0 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
Dim img As prt.RenderImage
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code39
'Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
Bar.BarRatio = 0.3
Bar.BarHeight = 18

Bar.QuietZoneWidth = 2
Bar.AddCheckSum = False
Bar.DisplayChecksum = False
Dim rm As prt.RenderEmpty '定一个空对象

Dim idx As Integer = 0
For i As Integer = 0 To Tables("表A").rows.Count - 1 Step 4

    For j As Integer = 0 To 3
        If i+j < Tables("表A").rows.Count
            Dim r As Row = Tables("表A").rows(i + j)
            Dim ra As new prt.RenderArea
            ra.width = 50
            ra.X = j * 50 + 5
            ra.Y = 5  + idx * 50
            ra.Style.Spacing.Right = 2 '设置标签之间的所有和上下间隔为2毫米
            ra.Style.Spacing.Bottom = 2
            ra.Style.Padding.All = 1 ' 标签内容距离边框为1毫米
            ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) '设置边框
            Dim txt As new prt.RenderText
            
            txt.text = "XXXXXX公司"
            txt.X = 10
            txt.y = 5
            ra.children.add(txt)
            
            txt = new prt.RenderText
            txt.text = r("第一列")
            txt.x = 40
            txt.y =5
            ra.children.add(txt)
            
            
            bar.Code = r("第二列")
            img = new prt.RenderImage
            img.Image = bar.GetImage
            img.x = 10
            img.y = 10
            
            ra.children.add(img)
            Doc.Body.Children.Add(ra)
        End If
    Next
idx += 1
Next
Doc.Preview()

 回到顶部