Foxtable(狐表)用户栏目专家坐堂 → 【已解决】自制条码模糊无法解决。建议使用原生代码生成的条码[求助]这种方式能一次性生成多页标签吗?


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

主题:【已解决】自制条码模糊无法解决。建议使用原生代码生成的条码[求助]这种方式能一次性生成多页标签吗?

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
【已解决】自制条码模糊无法解决。建议使用原生代码生成的条码[求助]这种方式能一次性生成多页标签吗?  发帖心情 Post By:2020/9/3 22:42:00 [显示全部帖子]

[求助]这种方式能一次性生成多页标签吗?是一次性生成出来慢慢打印,而不是生成一次打印一次(开始打印只出现一次)



Dim doc As New PrintDoc '定义一个报表
Dim
tbl As Table = Tables("员工")
For
i as Integer = tbl.TopRow To tbl.BottomRow
    Dim
rw As Row = tbl.Rows(i)
    Dim
rt As New prt.RenderTable() '定义一个表格对象
   
Dim rx As New prt.RenderText '定义一个文本对象
   
Dim ra As New prt.RenderArea '定义一个容器
   
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never  '禁止容器因为分页而被垂直分割
    '加入标题

    rx.text =
"员工资料卡"
    rx.Style.FontBold =
True '字体加粗
    rx.Style.FontSize =
16 '大体大小为16磅
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
'水平居中排列
    rx.Style.Spacing.Bottom =
3 '和下面的对象(表格)距离3毫米
    ra.Children.Add(rx)
'加入到容器中
    '指定行数、列数、列宽、行高

    rt.Rows.Count =
7 '设置总行数
    rt.Cols.Count =
5 '设置总列数
    rt.Height =
75 '设置表格的高度
    rt.Rows(
6).Height = 30 '设置第7行(显示备注的行)的高度,剩余高度被平均分排到其他行
    rt.Cols(
0).Width = 26 '设置前四列的宽度,剩余的宽度被分配给5列(显示图片的那列)
    rt.Cols(
1).Width = 35
    rt.Cols(
2).Width = 26
    rt.Cols(
3).Width = 40
   
'设置合并单元格
    rt.Cells(
0,4).SpanRows = 6 '第1行第5个单元格向下合并6行(用于显示照片)
    rt.Cells(
4,1).SpanCols = 3 '第5行第2个单元格向右合并3列(用于显示地址)
    rt.Cells(
6,0).SpanCols = 5 '第7行第1个单元格向右合并5列(用于显示备注)
    '设置表格样式

    rt.CellStyle.Spacing.All =
1 '单元格内容缩进1毫米
    rt.Style.Spacing.Bottom =
5 '和下一个资料卡的距离是5毫米
    rt.Style.GridLines.All = New prt.Linedef
'设置网格线
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
'内容垂直居中
    rt.Rows(
6).Style.TextAlignVert = prt.AlignVertEnum.Top '唯独第7行是备注,内容靠上对齐
    '下面很简单,指定每一个单元格的内容

    rt.Cells(
0,0).Text= "姓名"
    rt.Cells(
0,1).Text = rw("姓名")
    rt.Cells(
0,2).Text= "出生日期"
    rt.Cells(
0,3).Text = rw("出生日期")
    rt.Cells(
1,0).Text= "部门"
    rt.Cells(
1,1).Text = rw("部门")
    rt.Cells(
1,2).Text= "雇佣日期"
    rt.Cells(
1,3).Text = rw("雇佣日期")
    rt.Cells(
2,0).Text= "性别"
    rt.Cells(
2,1).Text = rw("性别")
    rt.Cells(
2,2).Text= "职务"
    rt.Cells(
2,3).Text = rw("职务")
    rt.Cells(
3,0).Text= "城市"
    rt.Cells(
3,1).Text = rw("城市")
    rt.Cells(
3,2).Text= "邮政编码"
    rt.Cells(
3,3).Text = rw("邮政编码")
    rt.Cells(
4,0).Text= "地址"
    rt.Cells(
4,1).Text = rw("地址")
    rt.Cells(
5,0).Text= "家庭电话"
    rt.Cells(
5,1).Text = rw("家庭电话")
    rt.Cells(
5,2).Text= "办公电话"
    rt.Cells(
5,3).Text = rw("办公电话")
    rt.Cells(
6,0).Text = rw("备注")
    rt.Cells(
0,4).Image = GetImage(rw("照片"))
    ra.Children.Add(rt)
'加入到容器中
    Doc.Body.ChildRen.Add(ra)
'将容器加入到报表中
Next

Doc.Preview()
'预览报表

[此贴子已经被作者于2020/9/17 9:21:29编辑过]

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/9/3 22:51:00 [显示全部帖子]

我好像是要这样的效果


Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width =76 '纸张宽度
doc.PageSetting.Height =130 '纸张高度

doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式


    For i As Integer = 1 To 5
        
        
        Dim rt As New prt.RenderTable() '定义一个表格对象
        Doc.PageSetting.LeftMargin = 0 '设置左边距
        Doc.PageSetting.RightMargin = 0 '设置右边距
        Doc.PageSetting.TopMargin = 0 '设置上边距
        Doc.PageSetting.BottomMargin = 0 '设置下边距
        rt.Width = "Parent.Width" '对象宽度等于页面宽度
        rt.Height = "Parent.Height" '对象高度等于页面高度
        '指定行数?列数?列宽?行高
        rt.Rows.Count = 10 '设置总行数
        rt.Cols.Count = 4 '设置总列数
        rt.Rows(0).Height = 10 '
        rt.Rows(1).Height = 5 '
        rt.Rows(2).Height = 12 '
        rt.Rows(3).Height = 18 '
        rt.Rows(4).Height = 10 '
        rt.Rows(5).Height = 7 '
        rt.Rows(6).Height = 13 '
        rt.Rows(7).Height = 6 '
        rt.Rows(8).Height = 6 '
        rt.Rows(9).Height = 28 '
        rt.Rows(10).Height = 14 '
        
        
        '设置列宽度
        rt.Cols(0).Width = 8.5 '设置前四列的宽度,剩余的宽度被分配给5列(显示图片的那列)
        rt.Cols(1).Width = 29.5
        rt.Cols(2).Width = 23
        rt.Cols(3).Width = 15
        '设置合并单元格
        
        rt.Cells(0,0).SpanCols =2 '
        rt.Cells(1,0).SpanCols = 2 '
        rt.Cells(1,2).SpanCols = 2 '
        rt.Cells(2,0).SpanCols = 4 '
        rt.Cells(3,0).SpanCols = 4 '
        rt.Cells(4,0).SpanCols = 2 '
        
        rt.Cells(5,1).SpanCols = 2 '
        rt.Cells(5,0).SpanRows = 2 '
        rt.Cells(6,1).SpanCols = 2 '
        rt.Cells(7,0).SpanRows = 2 '
        rt.Cells(7,1).SpanCols = 2 '
        rt.Cells(8,1).SpanCols = 2 '
        rt.Cells(9,0).SpanCols = 4 '
        rt.Cells(10,0).SpanCols = 2 '
        rt.Cells(10,2).SpanCols = 2 '
        
        rt.Cells(5,3).SpanRows = 4 '
        '设置表格样式
        rt.CellStyle.Spacing.All = 1 '单元格内容缩进1毫米
        rt.Style.GridLines.All = New prt.Linedef '设置网格线
        rt.Style.GridLines.All = new Prt.LineDef(Color.Gainsboro) '设置网格颜色
        rt.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
        rt.Rows(9).Style.TextAlignVert = prt.AlignVertEnum.Top '唯独第7行是备注,内容靠上对齐
        '''下面很简单,指定每一个单元格的内容
        rt.Cells(0,0).Text= "zto"
        rt.Cells(0,0).Style.Font = New Font("微软雅黑", 16, FontStyle.Bold) '设置字体
........
        rbc.ShowText = False
        rt.Cells(5,3).RenderObject = rbc  '将单元格内容设置为图片对象rm
        
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Next
Doc.Preview() '预览报表

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/9/4 17:10:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:生成条码代码.png
图片点击可在新窗口打开查看


我已经生成了条形码代码,要怎么样才能添加入表格里面?

Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Bar.Code = "75376451448390"
Bar.BarWidth = 0.5
Bar.BarRatio = 3
Bar.BarHeight = 9
Bar.QuietZoneWidth = 2
Bar.Font = New Font("微软雅黑",9,FontStyle.Bold)
Bar.TextFont = New Font("微软雅黑",9,FontStyle.Bold)
Bar.SaveImage("文件名")


 要添加到:rt.Cells(0,4)
[此贴子已经被作者于2020/9/4 17:13:33编辑过]

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/9/15 23:47:00 [显示全部帖子]

第一种
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Bar.Code = "75376451448390"
Bar.BarWidth = 0.5
Bar.BarRatio = 3
Bar.BarHeight = 9
Bar.QuietZoneWidth = 2
Bar.Font = New Font("微软雅黑",9,FontStyle.Bold)
Bar.TextFont = New Font("微软雅黑",9,FontStyle.Bold)
Bar.SaveImage("c:\data\MyBar.png")
rt.Cells(4,4).Image = GetImage("c:\data\MyBar.png")

第二种

Dim doc As New PrintDoc
Dim
rbc As New prt.RenderBarCode()
rbc.Height =
25
rbc.BarCodeType = BarCodeEnum.Code39
rbc.BarDirection = BarDirectionEnum.Normal
rbc.Text =
"123456"
rbc.ShowText =
True
doc.Body.Children.Add(rbc)
Doc.Preview()

第一种方法生成的条形码不清楚,即使我生成超大的文件,然后缩小也不清楚。要怎么才能像第二种生成的条形码一样清楚呢?
我对条形码有要求,第二种生成的不符合要求
[此贴子已经被作者于2020/9/15 23:51:03编辑过]

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/9/15 23:48:00 [显示全部帖子]

要打在76*130这么大纸上

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/9/16 8:46:00 [显示全部帖子]

这种方法不合适,我需要生成指定规格的码值,就是这种,有没有办法能生成这种又能清晰?
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
Bar.Code = "75376451448390"
Bar.BarWidth = 0.5
Bar.BarRatio = 3
Bar.BarHeight = 9
Bar.QuietZoneWidth = 2
Bar.Font = New Font("微软雅黑",9,FontStyle.Bold)
Bar.TextFont = New Font("微软雅黑",9,FontStyle.Bold)


以下是引用有点蓝在2020/9/16 8:32:00的发言:

Dim rbc As New prt.RenderBarCode()
rbc.Height = 25
rbc.BarCodeType = BarCodeEnum.Code39
rbc.BarDirection = BarDirectionEnum.Normal
rbc.Text = "123456"
rbc.ShowText = True

Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
doc.Body.Children.Add(rt) '将表格对象加入到报表中
rt.Style.GridLines.All = New prt.Linedef(Color.DarkGray) '将表格的颜色设为深灰色
rt.Rows.Count = 3 '设置行数
rt.Cols.Count = 3 '设置列数
rt.Width = 60 '设置表格的宽度
rt.Height = 60 '设置表格的高度
rt.Cells(1,1).RenderObject = rbc '将单元格内容设置为图片对象rm
Doc.Preview() '预览报表


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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/9/16 19:36:00 [显示全部帖子]

Dim Bar As New BarCodeBuilder
Dim img As prt.RenderImage
Bar.Symbology = Barpro.Symbology.Code128
Bar.Code = "75376451448390"
Bar.BarWidth = 0.5
Bar.BarRatio = 3
Bar.BarHeight = 9
Bar.QuietZoneWidth = 2
Bar.Font = New Font("微软雅黑",9,FontStyle.Bold)
Bar.TextFont = New Font("微软雅黑",9,FontStyle.Bold)
img = new prt.RenderImage
img.Image = bar.GetImage
'rt.Cells(4,4).Image = img
'
Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
doc.Body.Children.Add(rt) '将表格对象加入到报表中
rt.Style.GridLines.All = New prt.Linedef(Color.DarkGray) '将表格的颜色设为深灰色
rt.Rows.Count = 3 '设置行数
rt.Cols.Count = 3 '设置列数
rt.Width = 60 '设置表格的宽度
rt.Height = 60 '设置表格的高度
rt.Cells(0,0).RenderObject = img '将单元格内容设置为图片对象rm
Doc.Preview() '预览报表

 回到顶部