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()
'加入标题
rx.text = _Userdwmc & "大额资金支出上会提案表"
rx.Style.FontBold = True '字体加粗
rx.Style.FontSize = 16 '大体大小为16磅
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
rx.Style.Spacing.Bottom =3 '和下面的对象(表格)距离3毫米
doc.Body.Children.Add(rx) '加入到报表中
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)
Dim dt As DataTable
Dim shjg As String = "审核通过"
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 Each Col As DataCol In Dt.DataCols
rt1.Cells(0,Count).Text = Col.Name
For r As Integer = 0 To dt.DataRows.Count - 1
rt1.Cells(r +1,Count).Text =dt.dataRows(r)(Col.Name)
Next
Count = Count + 1
Next
rt1.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt1.CellStyle.Spacing.All = 1
rt1.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt1)
doc.Preview()