把你按钮代码的中间那段for .......next 改为这样::::
dim nb as integer = 23 - tb.Rows.Count mod 23
For c As Integer = 0 To ColNames.Length - 1 '逐列设置和填入内容
rs2.cols(c).Style.TextAlignVert = prt.AlignVertEnum.Center '数据垂直居中
Rs2.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Center '数据水平居中
For r As integer = 0 To tb.Rows.Count -1 +nb '开始填入该列内容
if r <= tb.Rows.Count-1
rs2.rows(r+1).height = 8
rs2.Rows(R+1).Style.FontSize = 12'字体大小为12磅 '设置字体大小
Rs2.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c))
else
rs2.rows(r+1).height = 8
rs2.Rows(R+1).Style.FontSize = 12'字体大小为12磅 '设置字体大小
Rs2.Cells(r + 1, c).Text = ""
end if
Next
next
'设置各位置的网格线
我不会专业报表啊,别再问我了,