Dim doc As New PrintDoc '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象
Dim rz As New prt.RenderText '定义一个文本对象
'e.Form.Page.PaperKind = 8 '纸张类型改为A4
'e.Form.Page.Width = 250 '纸张宽度为294毫米
'e.Form.Page.Height = 210 '纸张高度为210毫米
'e.Form.Page.Landscape = True '横向打印
'e.Form.Page.LeftMargin = 20 '设置左边距
'e.Form.Page.RightMargin =20 '设置右边距
'e.Form.Page.TopMargin = 10 '设置上边距
'e.Form.Page.BottomMargin = 20 '设置下边距
'doc = e.Form.GernatePrintDoc()
'加入标题
doc.Body.Children.Add(rt) '加入到报表中
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.CellStyle.Spacing.All = 1 '内容距离网格线1毫米
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Cells(0,0).text = "大额资金支出上会提案表"
rt.Cells(0,0).SpanCols = 6 '合并第一行全部单元格,用于显示主标题
rt.Cells(0,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '主标题居中
rt.Cells(0,0).Style.Font = New Font("宋体", 16, FontStyle.Bold) '设置主标题字体
rt.Rows(0).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第一行的网格线
'rx.text = "大额资金支出上会提案表"
'rx.Style.FontBold = True '字体加粗
'rx.Style.FontSize = 16 '大体大小为16磅
'rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
'rx.Style.Spacing.Bottom =3 '和下面的对象(表格)距离3毫米
Dim rw As New prt.RenderArea
Dim rn As prt.RenderText
rw.Width = 250 '宽度等于分栏宽度
rw.Height = 30 '高度24毫米
rw.SplitHorzBehavior = prt.SplitBehaviorEnum.Never '禁止水平分割
rw.SplitVertBehavior = prt.SplitBehaviorEnum.Never '禁止垂直分割
rw.Style.Spacing.Bottom = 2
' ra.Style.Borders.All = New prt.Linedef(0.3, Color.Red) '设置边框
'Doc.Body.ChildRen.Add(rw) '将容器加入到报表中
rn = New prt.RenderText
rn.Text = "过会提案编码:"
rn.X = 2
rn.Y = 2
rw.Children.Add(rn) '添加到容器中
rn = New prt.RenderText
rn.Text = "jlbh"
rn.X = 25
rn.Y = 2
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "过会时间:"
rn.X = 2
rn.Y = "Prev.Bottom + 2" '垂直坐标位于迁移对象之下的2毫米
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "ghsj"
rn.X = 25
rn.Y = "Prev.Top" '垂直坐标和前一对象相同
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "过会类型:"
rn.X = 2
rn.Y = "Prev.Bottom + 2" '垂直坐标位于迁移对象之下的2毫米
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "ghlx"
rn.X = 25
rn.Y = "Prev.Top" '垂直坐标和前一对象相同
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "会议记录人:"
rn.X = 2
rn.Y = "Prev.Bottom + 6" '垂直坐标位于迁移对象之下的2毫米
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "hyjlr"
rn.X = 25
rn.Y = "Prev.Top" '垂直坐标和前一对象相同
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "会议主持人:"
rn.X = 120
rn.Y = 2
rw.Children.Add(rn) '添加到容器中
rn = New prt.RenderText
rn.Text = "hyzcr"
rn.X = 130
rn.Y = 2
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "参加会议人员:"
rn.X = 120
rn.Y = "Prev.Bottom + 6"
rw.Children.Add(rn) '添加到容器中
rn = New prt.RenderText
rn.Text = "cjhyry"
rn.X = 145
rn.Y = "Prev.Top"
rw.Children.Add(rn)
rn = New prt.RenderText
rn.Text = "列席:"
rn.X = 120
rn.Y = "Prev.Bottom + 8"
rw.Children.Add(rn) '添加到容器中
rn = New prt.RenderText
rn.Text =" lx"
rn.X = 145
rn.Y = "Prev.Top"
rw.Children.Add(rn)
rt.Cells(1,0).Area .Children.Add (rw)
'rt.Cells(1,1).text = "jlbh"
rt.Cells(1,0).SpanCols = 6 '合并第一行全部单元格,用于显示主标题
rt.Rows(1).Style.Borders.All = New prt.LineDef("0mm", Color.white) '去掉第二行的网格线
rt.Rows(1).Style.Borders.Bottom = New prt.Linedef '恢复第二行底端的网格线
rt.Rows(1).Height = 30 '设置第二行的高度,拉开和表格主体的距离.
Dim dt As DataTable
Dim shjg As String = "审核通过"
rt.RowGroups(0,2).Header = prt.TableHeaderEnum.All '前四行作为表头
'Dim g As New GroupTableBuilder("统计表1", DataTables("大额资金支出备案登记表"),"审核结果='" & shjg & "'and 过会提案编码 = '" & jlbh & "'")
'g.Groups.AddDef("大额资金支付备案编码","大额资金支付备案编码") '根据根据用户账号分组
'g.Groups.AddDef("部门名称","申报部门名称") '根据根据用户账号分组
'g.Groups.AddDef("用户姓名","填报人") '根据用户姓名分组
'g.Groups.AddDef("付款单位账户名称","付款单位账户名称") '根据用户姓名分组
'g.Groups.AddDef("收款单位账户名称","收款单位账户名称") '根据用户姓名分组
'g.Groups.AddDef("支付性质","支付性质") '根据用户姓名分组
'g.Groups.AddDef("支付项目名称和内容","支付项目名称和内容") '根据用户姓名分组
'g.Groups.AddDef("支付金额","支付金额") '根据用户姓名分组
'g.Groups.AddDef("需要提前支付时间",DateGroupEnum.none,"提前支付时间") '根据用户姓名分组
'g.Groups.AddDef("提前支付理由","提前支付理由") '根据用户姓名分组
'g.Groups.AddDef("本单位过会时间",DateGroupEnum.none,"本单位过会时间")'根据用户姓名分组
'g.FromServer = True
'DT=g.build(True)
'dt.DataCols("提前支付时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime)
'dt.DataCols("本单位过会时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime)
'Dim rt1 As New prt.RenderTable
Dim Count As Integer = 0
For i As Integer = 0 To 5
rt.Cells(2,i).Text = i
For r As Integer = 2 To 100
rt.Cells(r +1,i).Text = r
Next
Next
'doc.Body.Children.Add(rt1)
doc.Preview()