Dim rt9 As New prt.RenderTable '定义一个新表格
Dim tb9 As Table = Tables("生产单.生产单制程")
Dim ColNames9 As String() = New String(){"制程","操作执行_总结","操作执行_分析","生产情况_总结","生产情况_分析","物料使用_总结","物料使用_分析"}
Dim hd9 As Integer = tb9.HeaderRows '获得表头的层数
rT9.Cols(0).Width =10
rt9.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded '表格宽度超出页宽时,可以水平换页
rt9.Style.Font = tb9.Font
'tb9.CreateReportHeader(RT9,True) '生成表头,排除隐藏列
For c9 As Integer = 0 To ColNames9.Length - 1 '逐列设置和填入内容
'rt9.Cells(0,c9).Text = ColNames9(c9) '列名作为标题
rt9.Cells(0,c9).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
rT9.Style.FontSize = 12
For r9 As Integer = 0 To tb.Rows.Count -1 '开始填入该列内容
rt9.Cells(r9 + HD9, c9).Text = tb9.Rows(R9)(ColNames9(c9))
Next
Next
rt9.Style.Gridlines.All = New prt.Linedef(Color.Gray) '灰色网格线
rt9.CellStyle.Spacing.All = 0.5 '单元格内距设为0.5毫米
rt9.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中
rt9.RowGroups(0, tb9.HeaderRows).Header = prt.TableHeaderEnum.All '利用行组功能设置表头
doc.Body.Children.Add(rt9)
老师好,我这上面的代码,生产多层表头,总是写不对,少了句表生成表头,你帮我看一下少那句。谢谢