Dim doc As New PrintDoc Dim rt As New prt.RenderTable() doc.Body.Children.Add(rt) rt.Style.GridLines.All = New prt.Linedef rt.cells(0,0).text = "客户名" rt.cells(0,1).text = "地区" rt.cells(0,2).text = "重量1" rt.cells(0,3).text = "重量2" rt.cells(0,4).text = "重量3" rt.cells(0,5).text = "重量4" rt.cells(0,6).text = "重量5" For i As Integer = Tables("发货单表").TopPosition To Tables("发货单表").BottomPosition Dim dr As DataRow = Tables("发货单表").Rows(i).DataRow Dim crs As List(of DataRow) = dr.GetChildRows("公斤数录入") If crs.count > 0 Then rt.Rows.Count = rt.Rows.count +1 Dim st As Integer = rt.Rows.count - 1 '起始行位置 Dim nt As Integer = st '当前行位置 Dim cp As Integer = 2 '当前列位置 rt.cells(st,0).text = dr("客户名") rt.cells(st,1).text = dr("地区") For n As Integer = 0 To crs.count -1 rt.cells(nt,cp).text = crs(n)("公斤数") cp = cp + 1 If cp = 7 Then cp=2 nt = nt +1 End If Next rt.cells(st,0).SpanRows = nt -st +1 rt.cells(st,1).SpanRows = nt -st +1 End If Next doc.Preview() '预览报表
|