Foxtable(狐表)用户栏目专家坐堂 → [求助]直接打印为什么打印不出来,而且还是按照100*180的格式打印的?


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

主题:[求助]直接打印为什么打印不出来,而且还是按照100*180的格式打印的?

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10403 威望:0 精华:0 注册:2018/10/16 11:42:00
[求助]直接打印为什么打印不出来,而且还是按照100*180的格式打印的?  发帖心情 Post By:2019/11/12 9:52:00 [只看该作者]

'''
Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width =76 '纸张宽度为100毫米
doc.PageSetting.Height =130 '纸张高度为120毫米
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).Style.BackColor = Color.Black
Dim rx As New prt.RenderText '定义一个文本对象
rx.Text = "  VIP:于野LH"
rx.Style.Font = New Font("微软雅黑", 14, FontStyle.Bold)
rx.Style.TextColor = Color.white
rt.Cells(0,0).RenderObject = rx '将文本对象放置在单元格中

'rt.Cells(0,0).Text= "zto"
'rt.Cells(0,0).Style.Font = New Font("微软雅黑", 16, FontStyle.Bold) '设置字体

rt.Cells(0,3).Text= "第12/592页"
rt.Cells(0,3).Style.Font = New Font("微软雅黑", 7, FontStyle.Bold) '设置字体

'rt.Cells(0,2).Style.BackColor = Color.Black
'Dim rx As New prt.RenderText '定义一个文本对象
'rx.Text = "诺诚LC"
'rx.Style.Font = New Font("微软雅黑", 14, FontStyle.Bold)
'rx.Style.TextColor = Color.white
'rt.Cells(0,2).RenderObject = rx '将文本对象放置在单元格中

rt.Cells(0,2).Text= "普通订单"
rt.Cells(0,2).Style.Font = New Font("微软雅黑", 14, FontStyle.Bold) '设置字体

rt.Cells(1,0).Text= "回单号:368806664526"
rt.Cells(1,0).Style.Font = New Font("微软雅黑",6, FontStyle.Bold) '设置字体

rt.Cells(1,2).Text= "订单号:368806664526"
rt.Cells(1,2).Style.Font = New Font("微软雅黑", 6, FontStyle.Bold) '设置字体

rt.Cells(2,0).Text= "大头笔7582-151"
rt.Cells(2,0).Style.Font = New Font("微软雅黑",20, FontStyle.Bold) '设置字体

rt.Cells(4,0).Text= "集包地"
rt.Cells(4,0).Style.Font = New Font("微软雅黑", 16, FontStyle.Bold) '设置字体

rt.Cells(4,2).Text= "2019-10-15 13:57:37"
rt.Cells(4,2).Style.FontSize = 8  '字体大小为16磅
rt.Cells(5,1).Text= "姓名  15616161515"
rt.Cells(5,1).Style.Font = New Font("微软雅黑", 9, FontStyle.Bold) '设置字体

rt.Cells(6,1).Text= "湖南省 益阳市 赫山区 晓园嘉苑西二栋"
rt.Cells(6,1).Style.Font = New Font("微软雅黑",9, FontStyle.Regular) '设置字体

rt.Cells(5,0).Text= "收"
rt.Cells(5,0).Style.Font = New Font("微软雅黑", 14, FontStyle.Bold) '设置字体

rt.Cells(7,0).Text= "寄"
rt.Cells(7,0).Style.Font = New Font("微软雅黑", 14, FontStyle.Bold) '设置字体

rt.Cells(7,1).Text= "姓名  15616161515"

rt.Cells(8,1).Text= "湖南省 益阳市 赫山区 晓园嘉苑西二栋"
rt.Cells(8,1).Style.Font = New Font("微软雅黑",8, FontStyle.Regular) '设置字体

rt.Cells(9,0).Text= "自定义区:121545"
rt.Cells(9,0).Style.Font = New Font("微软雅黑",8, FontStyle.Bold) '设置字体

rt.Cells(10,0).Text= "本次服务适用于中通官网(www.zto.com)公示的快递服务协议条款.您对此单的签收代表您已收到快件且包装完好无损."
rt.Cells(10,0).Style.Font = New Font("微软雅黑",6, FontStyle.Regular) '设置字体

rt.Cells(10,2).Text= "    于野LH"
rt.Cells(10,2).Style.Font = New Font("微软雅黑",14, FontStyle.Bold) '设置字体


rt.Cells(4,3).Text= "已验视  已实名"
rt.Cells(4,3).Style.Font = New Font("微软雅黑",9, FontStyle.Bold) '设置字体
rt.Cells(4,3).Style.GridLines.All = new Prt.LineDef(0.5,Color.Black) '设置网格颜色

Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
bar.Code = "368806664526"  '条形码
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rt.Cells(3,0).RenderObject = rg  '将单元格内容设置为图片对象rm


Dim rbc As New prt.RenderBarCode()
rbc.Height = 1

rbc.BarCodeType = BarCodeEnum.Code128
rbc.BarDirection = BarDirectionEnum.Up
rbc.Text = "368806664526"
rbc.ShowText = False
rt.Cells(5,3).RenderObject = rbc  '将单元格内容设置为图片对象rm

doc.Body.Children.Add(rt) '将表格对象加入到报表中

'Dim rt0 As prt.RenderText '定义一个文本对象
'rt0 = New prt.RenderText '设置文本对象的内容
'rt0.Text = "承诺达" '设置文本内容
'rt0.Width = "38" '宽度等于页面宽度
'rt0.Height = "245" '高度等于页面高度
'rt0.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中对齐
'rt0.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中对齐
'rt0.Style.Font = New Font("微软雅黑",14, FontStyle.Bold) '设置字体
'rt0.Style.TextColor = Color.DarkSlateGray '文本颜色为灰色
'Doc.WaterMark = rt0 '作为水印使用

Doc.Print () '打印

[求助]直接打印为什么打印不出来,而且还是按照100*180的格式打印的?
预览后打印确实按照代码的打

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


加好友 发短信 一级勋章
等级:超级版主 帖子:7235 积分:40574 威望:0 精华:16 注册:2008/8/31 23:23:00
  发帖心情 Post By:2019/11/12 10:09:00 [只看该作者]

指定一下打印机试试

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


加好友 发短信
等级:超级版主 帖子:107014 积分:544295 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/11/12 10:46:00 [只看该作者]

到打印机打印服务器属性添加一个76mm*130mm的纸张,并设置为指定打印机的默认纸张

 回到顶部