For c As Integer = 0 to 100
rt.Cols(c).Width = 15 '明确指定每一列的宽度
If c = 0 then
rt.Cells(0,0). Text = "编号"
Else
rt.Cells(0, c).Text = "第" & (c + 1) & "列"
End If
Next
For r As Integer = 1 To 50
rt.Cells(r,0).Text = r
For c As integer = 1 to 100
rt.Cells(r,c).Text = r & "," & c
Next
Next
改为下面代码,没有实现需求,实现增加编号列?如何实现?
For j As Integer = 0 To cols.Length - 1 '打印标题
If j = 0 Then
rt.Cells(0, 0).Text = "编号"
Else
' rt.Cells(0, c).Text = "第" & (c + 1) & "列"
rt.Cells(0, j).Text = cols(j)
End If
Next
'rt.Cells(0, 0).Text = "编号"