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 '标题内容水平居中 If ColNames(c) <> "备注" Then ' rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth End If For r As Integer = 0 To Rows .Count -1 '开始填入该列内容 rt.Cells(r + 1, c).Text = Rows (r)(ColNames(c)) Next Next
|