Foxtable(狐表)用户栏目专家坐堂 → 怎么设计这个报表


  共有7834人关注过本帖树形打印复制链接

主题:怎么设计这个报表

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/4/26 17:34:00 [显示全部帖子]

新建一个项目。设计好这两个表,输入一些测试数据,然后发上来看看。

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251060 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/4/27 9:20:00 [显示全部帖子]

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() '预览报表

 回到顶部