'页面设置
Dim doc As New PrintDoc '定义一个报表
Doc.PageSetting.LeftMargin = 15
Doc.PageSetting.BottomMargin = 15
Doc.PageSetting.TopMargin = 15
Doc.PageSetting.rightMargin = 15
Dim rm As prt.RenderEmpty '定一个空对象
doc.Pagesetting.LandScape = True
'设置页脚
Dim yj As New prt.RenderText '定义一个文本对象
yj = New prt.RenderText '设置文本对象的内容
yj.Text = "第[PageNo]页 共[PageCount]页" '设置文本内容
yj.Style.TextAlignHorz = prt.AlignHorzEnum.center '页脚中间对齐
yj.Style.FontSize = 9 '字体大小为10磅
yj.Style.Padding.Bottom = -10 '底端内容缩进10毫米
Doc.PageFooter = yj '作为页脚使用
Dim tbl8 As Table = Tables("隐患排查治理台账")
'排查表
Dim rt8 As Prt.RenderTable
Dim rx8 As prt.RenderText
Dim Rows8 As List(Of DataRow)
'设置二级标题
rx8 = New prt.RenderText
rx8.Style.FontSize = 16
rx8.Style.Spacing.Bottom = 5
Dim dr As String = Forms("mainform").controls("安全检查台账企业名称").value
rx8.text = dr & vbcrlf & "隐患排查台账" '表标题显示企业名称
rx8.Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题水平居中
doc.Body.Children.Add(rx8)
'设置表格样式
rt8 = New prt.RenderTable
rt8.Style.TextAlignVert = prt.AlignVertEnum.Center
rt8.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
rt8.Style.Spacing.Bottom = 5
rt8.CellStyle.Spacing.All = 1
rt8.Style.Font = tbl8.Font
'设置表格细节
Rows8 = tbl8.DataTable.Select("企业名称 Like '*" & Forms("mainform").controls("安全检查台账企业名称").value & "*' and 年度 Like '*" & Forms("mainform").controls("安全检查台账年度").value & "*' and 检查时间 >= #" & Forms("mainform").controls("DateTimePicker8").Value & "# and 检查时间 <= #" & Forms("mainform").controls("DateTimePicker9").Value & "#","检查时间") '指定符合条件的行和排序方式
Dim nms8() As String = {"年度","检查类型","检查时间","所在部门","隐患内容","整改措施","隐患照片","责任人","完成时间","备注"}
Dim caps() As String = {"序号","检查类型","检查时间","所在部门","隐患内容","整改措施","隐患照片","责任人","完成时间","备注"} '自定义列名
For c As Integer = 0 To nms8.length - 1
Dim ary() As String = caps(c).split("|")
For i As Integer = 0 To ary.length-1
rt8.cells(i, c).text = ary(i)
Next '打印的列标题自定义
rt8.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
rt8.Cols(0).Width = 15 '设置各列宽度
rt8.Cols(1).Width = 30
rt8.Cols(2).Width = 30
rt8.Cols(3).Width = 35
rt8.Cols(4).Width = 60
rt8.Cols(5).Width = 50
rt8.Cols(6).Width = 50
rt8.Cols(7).Width = 25
rt8.Cols(8).Width = 30
rt8.Cols(9).Width = 25
For r As Integer = 0 To Rows8.Count -1
If c=0 Then
rt8.Cells(r + 1, c).Text = r+1 '增加了序号列,并自动填充
Else
rt8.Cells(r + 1, c).Text = rows8(r)(tbl8.Cols(nms8(c)).Name)
End If
Next
Next
rt8.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt8)
Doc.Preview() '预览报表
请老师看一下哪错了,怎么改?谢谢