'设置检查表表格样式
rt9 = New prt.RenderTable
rt9.Style.TextAlignVert = prt.AlignVertEnum.Center
rt9.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
rt9.Style.Spacing.Bottom = 2
rt9.CellStyle.Spacing.All = 1
rt9.Style.Font = New Font("宋体", 11)
'设置检查表表格细节
Dim dr As DataRow
Dim filter As String = "企业名称 Like '%" & Forms("mainform").controls("combobox13").value & "%' and 公司级综合 = true and 作业步骤或检查项目_类型 = '安全生产' and 管控措施_内容 <> '无'"
Dim Products As List(Of String) = tbl8.DataTable.getvalues("风险点_名称",filter)
'Rows9 = tbl8.DataTable.Select("企业名称 Like '*" & Forms("mainform").controls("combobox13").value & "*' and 公司级综合 = true and 作业步骤或检查项目_类型 = '安全生产' and 管控措施_内容 <> '无'","风险点_名称") '指定符合条件的行和排序方式
Dim nms9() As String = {"风险点_编号","风险点_名称","检查结果_符合性","备注","备注","备注"} '指定要显示的列即要打印的列
Dim caps9() As String = {"序号","风险点_名称","检查结果","问题描述","整改责任人","整改时限"} '自定义列名
For c As Integer = 0 To nms9.length - 1
Dim ary() As String = caps9(c).split("|")
For i As Integer = 0 To ary.length-1
rt9.cells(i, c).text = ary(i)
Next '打印的列标题自定义
rt9.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
rt9.Cols(0).Width = 15 '设置各列宽度
rt9.Cols(1).Width = 40
rt9.Cols(2).Width = 20
rt9.Cols(3).Width = 160
rt9.Cols(4).Width = 25
rt9.Cols(5).Width = 20
For r As Integer = 0 To Products.Count -1
dr = tbl8.DataTable.find("风险点_名称 = '" & Products(r) & "' And " & filter )
If dr Is Nothing Then Continue For
If c=0 Then
rt9.Cells(r + 1, c).Text = r+1 '增加了序号列,并自动填充
ElseIf tbl8.Cols(nms9(c)).IsBoolean
If dr(nms9(c)) = False
rt9.Cells(r + 1, c).Text = ""
End If
Else
rt9.Cells(r + 1, c).Text = dr(nms9(c))
End If
rt9.Rows(r+1).Height = 20 '设置行的高度
Next
Next
rt9.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt9)