批量打印第一张是正确的
第二章就移位了 如果我把合计去掉就正常了 请问一下 我这段代码要怎样修改?

此主题相关图片如下:1.png


此主题相关图片如下:2.bmp

For Each Col As DataCol In Dt.DataCols
rt.Cells(0,Count).Text = Col.Name
For r As Integer = 0 To dt.DataRows.Count-1
If r<dt.DataRows.Count Then
rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
Else
rt.Cells(r +1,1).Text = "合计"
rt.Rows(r+1).Height =10
If dr("合计列") >"" Then
Dim Multi As String = dr("合计列")
If Multi.Contains(Col.Name) Then
rt.Cells(r +1,Count).Text = dt.Compute("Sum(" & Col.Name & ")")
End If
End If
End If
Next
Count = Count + 1
Next
[此贴子已经被作者于2017/4/13 16:25:27编辑过]