以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]报表打印如何能打出黑底白字?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=141262)

--  作者:zto001
--  发布时间:2019/9/25 11:48:00
--  [求助]报表打印如何能打出黑底白字?
[求助]报表打印如何能打出黑底白字?
--  作者:有点蓝
--  发布时间:2019/9/25 11:57:00
--  
什么报表?
--  作者:zto001
--  发布时间: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   () \'预览报表

--  作者:有点蓝
--  发布时间: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() \'预览报表