是的,只能编码实现,不能用绑定的,我印象中之前给你写过类似的。
细节自己调整:
Dim doc As New PrintDoc '定义一个报表
Dim js As String = "海模"
Dim s As String
Dim rt As prt.RenderText
rt = new prt.RenderText
rt.text = "2013年" & js & "地区代表队"
doc.body.Children.add(rt)
For Each dq As String In DataTables("报名表").GetUniqueValues("竞赛名称 = '" & js & "'","区")
rt = new prt.RenderText
rt.text = vbcrlf & "地区:" & dq
doc.body.Children.add(rt)
s = ""
For Each nm As String In DataTables("报名表").GetUniqueValues("竞赛名称 = '" & js & "' And 区 = '" & dq & "'","领队")
s = s & nm & ","
Next
rt = new prt.RenderText
rt.text = "领队:" & s.trim(",")
doc.body.Children.add(rt)
s = ""
For Each nm As String In DataTables("报名表").GetUniqueValues("竞赛名称 = '" & js & "' And 区 = '" & dq & "'","教练")
s = s & nm & ","
Next
rt = new prt.RenderText
rt.text = "教练:" & s.trim(",")
doc.body.Children.add(rt)
Dim drs As List(of DataRow) = DataTables("报名表").Select("竞赛名称 = '" & js & "' And 区 = '" & dq & "'")
Dim tb As new prt.RenderTable
For i As Integer = 0 To drs.count -1 Step 5 '每行五个队员
For n As Integer = i To math.Min(drs.count -1,i + 4) '打印这五个队员
tb.cells(n \ 5, (n Mod 5) * 2).text = drs(n)("编号")
tb.cells(n \ 5, (n Mod 5) * 2 + 1).text = drs(n)("姓名")
Next
Next
doc.body.Children.add(tb)
Next
doc.Preview() '预览
[此贴子已经被作者于2013-6-14 15:15:07编辑过]