Foxtable(狐表)用户栏目专家坐堂 → [求助]为什么打印这种小标签的时候,打出来的尺寸跟预览的尺寸不一致?


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

主题:[求助]为什么打印这种小标签的时候,打出来的尺寸跟预览的尺寸不一致?

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
[求助]为什么打印这种小标签的时候,打出来的尺寸跟预览的尺寸不一致?  发帖心情 Post By:2021/8/23 23:27:00 [只看该作者]

我打印50*30的小标签的时候(应该是横着的),打印出来的尺寸却是30*50竖着出来的
我改电脑打印机里面的设置,无论设置成什么样的尺寸,设置旋转,改成横向,都无法改变竖着出来的情况。打小标签的时候老是这样,大标签不会有这样的情况。需要怎么弄?
以下是代码


Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width =50  '纸张宽度
doc.PageSetting.Height =30 '纸张高度
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式

Dim rt As New prt.RenderTable() '定义一个表格对象
Doc.PageSetting.LeftMargin = 1 '设置左边距
Doc.PageSetting.RightMargin = 1 '设置右边距
Doc.PageSetting.TopMargin = 0 '设置上边距
Doc.PageSetting.BottomMargin = 0 '设置下边距
rt.Width = "Parent.Width" '对象宽度等于页面宽度
rt.Height = "Parent.Height" '对象高度等于页面高度
rt.Rows.Count = 3 '设置总行数
rt.Rows(0).Height = 7 '
rt.Rows(1).Height = 15 '
rt.Rows(2).Height = 8 '
'设置列宽度
rt.Cols.Count = 3 '设置总列数
rt.Cols(0).Width = 6  '设置列的宽度
rt.Cols(1).Width = 10
rt.Cols(2).Width = 44

'设置合并单元格
rt.Cells(0,0).SpanCols =3 '
rt.Cells(2,1).SpanCols = 2 '



rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Style.GridLines.All = new Prt.LineDef(Color.white) '设置网格颜色
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Left '内容水平靠左
rt.Style.TextAlignVert = prt.AlignVertEnum.Top '内容垂直靠上

'
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第七行水平居中
rt.Cells(0,0).Style.BackColor = Color.white
Dim rx As New prt.RenderText '定义一个文本对象
rx.Text = "PDA扫描枪(Android 7.1)"
rx.Style.Font = New Font("微软雅黑", 10, FontStyle.Bold)
rx.Style.TextColor = Color.white
rt.Cells(0,0).RenderObject = rx '将文本对象放置在单元格中
rt.Cells(0,0).Style.BackColor = Color.Black


rt.Cells(1,1).Text= "子慕百货百货"
rt.Cells(1,1).Style.Font = New Font("微软雅黑",8, FontStyle.Bold) '设置字体

rt.Cells(2,1).Text= "含数据线,电池,主机含数据线,电池,主机含数据线,电池,主机"
rt.Cells(2,1).Style.Font = New Font("微软雅黑",8, FontStyle.Regular) '设置字体

'【添加条形码】
Dim rg As New prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.Code128
bar.Code = "WL001"  '条形码
Bar.BarWidth = 0.3
Bar.BarHeight = 8

rg = new prt.RenderGraphics
rg.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center '图片水平居中
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rt.Cells(1,2).RenderObject = rg  '将单元格内容设置为图片对象rm


Dim rmj As New prt.RenderImage '定义一个图片对象
rmj.Image = GetImage("C:\Users\admin\Downloads\管理.png") '设置图片
rt.Cells(1,0).RenderObject = rmj  '将单元格内容设置为图片对象rm

Dim rms As New prt.RenderImage '定义一个图片对象
rms.Image = GetImage("C:\Users\admin\Downloads\备注.png") '设置图片
rt.Cells(2,0).RenderObject = rms  '将单元格内容设置为图片对象rm
doc.Body.Children.Add(rt) '将表格对象加入到报表中
Doc.Preview() '预览报表


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


加好友 发短信
等级:超级版主 帖子:106132 积分:539771 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/8/24 8:35:00 [只看该作者]

打印和预览要分开2个按钮,不能在预览里进行打印。

 回到顶部