\'设置明细表标题列---------------------------------2
rt.Rows(rt.Rows.Count).Height = 10
rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体", 8) \'设置行字体
rt.Rows(rt.Rows.Count-1).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'文本水平居中
Dim nms As String() = {"序号","处理日期","产品编码","品名","数量","结案日期","负责人","跟踪人","跟踪日期","责任部门","承担损失"} \'明细表标题列
For c As Integer = 0 To nms.Length -1
rt.Cells(rt.Rows.Count-1,c).Text = nms(c)
Next
ra.Children.Add(rt) \'将文本对象加入到容器ra中
doc.PageHeader = ra \'--设置以上部分为页眉-------------------
ra = New prt.RenderArea \'定义一个容器
rt = New prt.RenderTable() \'定义一个表格对象
\'指定总列数及各列宽,未指定的平分剩余宽度
CW = dr("Bodycw") \'""
Cls = CW.split("|")
rt.Cols.Count = Cls.Length + 1 \'设置总列数
For i As Integer = 0 To Cls.Length-1
rt.Cols(i).Width = Cls(i)
Next
\'设置表格总体样式-------------------------------------------
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Left \'文本水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'文本垂直居中
rt.CellStyle.Spacing.All = 1 \'单元格内容缩进1毫米
rt.Style.GridLines.All = New prt.Linedef(0.2,Color.Black) \'设置网格线
rt.Style.Font = New Font("宋体", prt_tbfontsize) \'设置总体字体
\'rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止被垂直分割
rt.SplitHorzBehavior = prt.SplitBehaviorEnum.SplitIfNeeded \'表格宽度超出页宽时,可以水平换页
Dim ColNames As String() = {"序号","处理日期","产品编码","品名","数量","结案日期","负责人","跟踪人","跟踪日期","责任部门","承担损失"} \'明细表
Dim drs As List(Of DataRow)
drs = DataTables("内部品质异常单_明细").Select("单据编号 = \'" & CurRow("单据编号") & "\'")
If drs.Count > 0 Then \'如果有值
For i As Integer = 0 To drs.Count-1
rt.Rows(rt.Rows.Count).Height = rh
For c As Integer = 0 To ColNames.Length -1
rt.cells(i,c).text = drs(i)(ColNames(c))
Next
Next
End If
ra.Children.Add(rt) \'将文本对象加入到容器ra中