Dim doc As PrintDoc = e.Form.GernatePrintDoc()
Dim idx As Integer = 0
Dim idx2 As Integer = 0
Dim t As Table = e.Form.Controls("Table1").Table
For Each c As object In Doc.Body.Children
If Typeof c Is prt.RenderText Then
If c.text = "数量和1" Then
Dim count As Double = 0
For i As Integer = idx To idx + 3
count += val(t.Rows(i)("数量"))
Next
c.text = cstr(count)
idx += 4
ElseIf c.text = "金额和1" Then
Dim count As Double = 0
For i As Integer = idx2 To idx2 + 3
count += val(t.Rows(i)("金额"))
Next
c.text = cstr(count)
idx2 += 4
End If
End If
Next
doc.Preview()