Foxtable(狐表)用户栏目专家坐堂 → 报表打印


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

主题:报表打印

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


加好友 发短信
等级:三尾狐 帖子:653 积分:7667 威望:0 精华:0 注册:2013/12/11 17:49:00
报表打印  发帖心情 Post By:2020/6/15 9:38:00 [只看该作者]

麻烦老师帮忙看一下 预览是正确的   打印机纸张变大之后 内容也跟着变大了

 

Dim r As Row =Tables("物料表").Current
Dim rg As prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.Code = "http://www.baidu.com"
Bar.QuietZoneWidth = 2
Bar.SaveImage(ProjectPath & "Reports\xsd" & r("物料代码") & ".jpg"  )
Dim doc As New PrintDoc '定义一个报表
doc.PageSetting.Width = 100 '纸张宽度为100毫米
doc.PageSetting.Height = 60 '纸张高度为120毫米

rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0,1)
rg.Style.Spacing.Top = 3

Dim rep As New prt.RenderEmpty '定义一个新的空对象
rep.BreakBefore = prt.BreakEnum.Page '打印前换页
doc.Body.Children.Add(rep ) '加入到报表中
Dim rt As New prt.RenderTable() '定义一个表格对象
rt.Style.Font = New Font("微软雅黑",8) '设置文本对象的字体
rt.Style.TextAlignHorz = prt.AlignHorzEnum.left
rt.Style.TextAlignVert =  prt.AlignHorzEnum.Center
rt.Style.Borders.All = New  prt.Linedef(0.5, Color.black)
rt.Cols(0).Width =2
rt.Cols(4).Width =2
rt.Cols(6).Width =2
rt.Cols(1).Width =15
rt.Height =55
For i As Integer = 1 To 5
    rt.Cells(0,i).Style.Borders.Bottom  =New prt.Linedef(0.1, Color.Gray , DashStyle.Solid ) '设置底边框
Next

For i As Integer = 1 To 5
    For J As Integer =1 To 3
        rt.Cells(i,j).Style.Borders.Bottom  =New prt.Linedef(0.1, Color.Gray , DashStyle.Solid ) '设置底边框
    Next
Next

For i As Integer = 0 To 6
    rt.Cells(i,2).Style.Font =New Font("微软雅黑", 8, FontStyle.Bold) '设置字体
Next
rt.Cells(0,4).Style.Font =New Font("微软雅黑", 8, FontStyle.Bold) '设置字体

rt.Cells(0,1).Text = "物料编码"
rt.Cells(0,2).Text =r("物料代码")
rt.Cells(0,3).Style.TextAlignHorz = prt.AlignHorzEnum.right
rt.Cells(0,3).Text =" 订单号"
rt.Cells(0,4).Text =""
rt.Cells(0,4).SpanCols =2
rt.Cells(1,1).Text = "物料名称"
rt.Cells(1,2).Text =r("物料名称")
rt.Cells(1,2).SpanCols =2
rt.Cells(2,1).Text = "物料尺寸"
rt.Cells(2,2).Text =r("规格型号")
rt.Cells(2,2).SpanCols =2
rt.Cells(2,5).Text =  ProjectPath & "Reports\xsd" & r("物料代码") & ".jpg"
rt.Cells(2,5).SpanRows =4
rt.Cells(2,5).RenderObject =rg
rt.Cells(3,1).Text = "定制产品"

Dim dz As String

rt.Cells(3,2).Text =dz
rt.Cells(3,2).SpanCols =2

rt.Cells(4,1).Text = "包装说明"
rt.Cells(4,2).Text = ""
rt.Cells(4,2).SpanCols =2

rt.Cells(5,1).Text = "进仓编号"
rt.Cells(5,2).Text =""
rt.Cells(5,2).SpanCols =2

rt.Cells(6,1).Text = "常规效果"
rt.Cells(6,2).Text =r("效果")
rt.Cells(6,2).SpanCols =5

doc.Body.Children.Add(rt)

Doc.PageSetting.LeftMargin = 2 '设置左边距
Doc.PageSetting.RightMargin = 2 '设置右边距
Doc.PageSetting.TopMargin = 2 '设置上边距
Doc.PageSetting.BottomMargin =2  '设置下边距

Doc.Preview

 

 

 

 

 

 

 

 

 

 


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


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

指定表格宽度

Dim rt As New prt.RenderTable() '定义一个表格对象
rt.Width = 96

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


加好友 发短信
等级:三尾狐 帖子:653 积分:7667 威望:0 精华:0 注册:2013/12/11 17:49:00
  发帖心情 Post By:2020/6/15 10:30:00 [只看该作者]

谢谢老师  如果是 240 * 140的纸张 这个设置了 但是会出现空白页   这个要怎么解决?

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


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

截图并贴出代码说明

 回到顶部