For c As Integer = 0 To ColNames.Length - 1 '逐列设置和填入内容
rt.Cells(0,c).Text = ColNames(c) '列名作为标题
rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '标题内容水平居中
rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth '列宽等于实际列宽
If tb.Cols(ColNames(c)).IsNumeric OrElse tb.Cols(ColNames(c)).IsDate Then '如果是数值或日期列
rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right '数据水平靠右
End If
For r As Integer = 0 To tb.Rows.Count -1 '开始填入该列内容
If tb.Rows(r)(ColNames(c)) <> "0" Then
rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) 是在这里处理吗?怎么加呢?
End If
If tb.Rows(r)("项目").StartsWith("一") Or tb.Rows(r)("项目").StartsWith("二") Or tb.Rows(r)("项目").StartsWith("三") Or tb.Rows(r)("项目").StartsWith("四") Then
rt.Cells(r + 1, c).Style.BackColor = Color.LightGray
rt.Cells(r + 1, c).Style.FontBold = True
End If
Next
Next