Foxtable(狐表)用户栏目专家坐堂 → [求助]报表打印如何能打出黑底白字?


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

主题:[求助]报表打印如何能打出黑底白字?

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
[求助]报表打印如何能打出黑底白字?  发帖心情 Post By:2019/9/25 11:48:00 [只看该作者]

[求助]报表打印如何能打出黑底白字?

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


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

什么报表?

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


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2019/9/26 8:54:00 [只看该作者]

       Dim doc As New PrintDoc '定义一个报表
        doc.PageSetting.Width = 100 '纸张宽度为100毫米
        doc.PageSetting.Height = 180 '纸张高度为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 = 11 '设置总行数
        rt.Cols.Count = 5 '设置总列数
        'rt.Height = 80 '设置表格的高度为80毫米
        rt.Cols(0).Width = 10 '设置前四列的宽度,剩余的宽度被分配给5列(显示图片的那列)
        '设置合并单元格
        rt.Cells(0,0).SpanCols = 5 '第5行第2个单元格向右合并3列(用于显示地址)
        rt.Cells(10,0).SpanCols = 5 '第5行第2个单元格向右合并3列(用于显示地址)
        '设置表格样式
        rt.CellStyle.Spacing.All = 1 '单元格内容缩进1毫米
        rt.Style.GridLines.All = New prt.Linedef '设置网格线
        rt.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
        rt.Rows(6).Style.TextAlignVert = prt.AlignVertEnum.Top '唯独第7行是备注,内容靠上对齐
        ''下面很简单,指定每一个单元格的内容
        rt.Cells(10,0).Text= dr("系统单号")
        rt.Cells(10,0).Style.FontBold = True '字体加粗
        rt.Cells(10,0).Style.FontSize = 16 '字体大小为16磅
        Dim rg As New prt.RenderGraphics
        Dim Bar As New BarCodeBuilder
        Bar.Symbology = Barpro.Symbology.Code128
        bar.Code = dr("快递单号") '条形码
        rg = new prt.RenderGraphics
        bar.DrawOnCanvas(rg.Graphics,0,0,1)
        rt.Cells(5,0).RenderObject = rg  '将单元格内容设置为图片对象rm
        Dim rg1 As New prt.RenderGraphics
        rg1 = new prt.RenderGraphics
        bar.DrawOnCanvas(rg1.Graphics,0,0,1)
        rt.Cells(7,2).RenderObject = rg1  '将单元格内容设置为图片对象rm
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
        Doc.Print   () '预览报表

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


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

比如:http://www.foxtable.com/webhelp/topics/1207.htm

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 = 150 '设置表格的宽度
rt.Height = 150 '设置表格的高度
rt.Cells(1, 2).Style.BackColor = Color.Crimson
rt.Cells(0, 1).Style.BackColor = Color.BlueViolet

Dim rx As New prt.RenderText '定义一个文本对象
rx.Text = "123"
rx.Style.Font = New Font("宋体", 16, FontStyle.Bold)
rx.Style.TextColor = Color.white
rt.Cells(1, 2).RenderObject = rx '将文本对象放置在单元格中

Doc.Preview() '预览报表

 回到顶部