Dim lx As winform.combobox = forms("mainform").controls("combobox12")
If lx.text = "公司级综合" And forms("mainform").Controls("tabcontrol2").SelectedIndex = 0 Then
'页面设置
Dim doc As New PrintDoc '定义一个报表
Doc.PageSetting.LeftMargin = 15
Doc.PageSetting.BottomMargin = 15
Doc.PageSetting.TopMargin = 15
Doc.PageSetting.LeftMargin = 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 = -20 '底端内容缩进10毫米
Doc.PageFooter = yj '作为页脚使用
Dim tbl8 As Table = Tables("隐患排查表_table21")
'排查表
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("combobox13").value
rx8.text = dr & vbcrlf & "公司级综合安全检查表" '表标题显示企业名称
rx8.Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题水平居中
doc.Body.Children.Add(rx8)
'设置表头下表格样式
Dim rt As Prt.RenderTable
rt = New prt.RenderTable
rt.Rows.Count = 1 '设置总行数
rt.Cols.Count = 8 '设置总列数
rt.Height = 15 '设置表格的高度
rt.Style.FontSize = 11 '大体大小为12磅
rt.Style.GridLines.All = New prt.LineDef(0.3,Color.blue)
'设置表格样式
rt.CellStyle.Spacing.All = 1 '单元格内容缩进1毫米
rt.Style.Spacing.Bottom = 5 '和下一个资料卡的距离是5毫米
rt.Style.GridLines.All = New prt.Linedef '设置网格线
rt.Style.TextAlignVert = prt.AlignVertEnum.Center '内容垂直居中
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题水平居中
rt.Cells(0,0).Text= "组织级别"
rt.Cells(0,2).Text= "排查周期"
rt.Cells(0,4).Text= "排查人签字"
rt.Cells(0,6).Text = "日期"
rt.Cells(0,1).Text= "公司级"
rt.Cells(0,3).Text= "每季度一次"
Doc.Body.ChildRen.Add(rt) '将容器加入到报表中
'设置表格样式
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("combobox13").value & "*' and 公司级综合 = true","风险点_编号,作业步骤或检查项目_序号") '指定符合条件的行和排序方式
Dim nms8() As String = {"风险点_名称","作业步骤或检查项目_名称","危险源或检查标准","管控措施_内容","责任单位","检查结果_符合性","检查结果_不符合描述","备注"} '指定要显示的列即要打印的列
For c As Integer = 0 To nms8.length - 1
rt8.Cells(0,c).Text = tbl8.Cols(nms8(c)).Name
rt8.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
'rt8.Cols(c).Width = tbl8.Cols(c).PrintWidth '根据原表格确定列宽
rt8.Cols(0).Width = 30 '设置各列宽度
rt8.Cols(1).Width = 30
rt8.Cols(2).Width = 40
rt8.Cols(3).Width = 100
rt8.Cols(4).Width = 30
rt8.Cols(5).Width = 30
rt8.Cols(6).Width = 50
rt8.Cols(7).Width = 30
For r As Integer = 0 To Rows8.Count -1
rt8.Cells(r + 1, c).Text = rows8(r)(tbl8.Cols(nms8(c)).Name)
Next
Next
rt8.RowGroups(0,1).Header = prt.TableHeaderEnum.All
doc.Body.Children.Add(rt8)
Doc.Preview() '预览报表
End If