Foxtable(狐表)用户栏目专家坐堂 → 专业报表做明细表输出问题


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

主题:专业报表做明细表输出问题

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


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

Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("表A.表B")

With Tables("表A.表B")
    For i As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
        rx = New prt.RenderText
        rx.Style.FontSize = 14
        rx.Style.FontBold = True
        rx.Style.Spacing.Bottom = 5
        rx.Text = "产品: " & Tables("表A.表B").Rows(i)("产品")
        doc.Body.Children.Add(rx)
        rt = New prt.RenderTable
        rt.Cols.Count = 2 '设置总列数
       
        rt.Style.TextAlignVert = prt.AlignVertEnum.Center
        rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
        rt.CellStyle.Spacing.All = 1
        rt.Cols.Count = 2
        rt.Cells(0,1).Text = "重量"
        rt.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
        rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
        rt.cols.Count = 11
        For r As Integer = 0 To 10
            rt.cols(i).width = 100 / 11
        Next

        Rows = Tables("表A.表B").Rows(i).DataRow.GetChildRows("表C")
        For r As Integer = 0 To Rows.Count - 1
            Dim rw As Integer = i \ 10
            Dim cl As Integer = r - rw * 10
            rt.Cells(rw + 1,cl + 1).Text = rows(r)("明细")
        Next


        For r As Integer = 1 To rt.Rows.Count - 1
            rt.Cells(r,0).text = r '逐行写入行号
        Next
       
        doc.Body.Children.Add(rt)
        rx = New prt.RenderText
        rx.Style.FontBold = True
        rx.Style.Spacing.Top = 3
        rx.Text = "总计: " & Tables("表A.表B").Rows(i)("重量")
        rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
        doc.Body.Children.Add(rx)
    Next
End With
doc.Preview

 


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


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

Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("表A.表B")

With Tables("表A.表B")
    For i As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
        rx = New prt.RenderText
        rx.Style.FontSize = 14
        rx.Style.FontBold = True
        rx.Style.Spacing.Bottom = 5
        rx.Text = "产品: " & Tables("表A.表B").Rows(i)("产品")
        doc.Body.Children.Add(rx)
        rt = New prt.RenderTable
        rt.Cols.Count = 2 '设置总列数
       
        rt.Style.TextAlignVert = prt.AlignVertEnum.Center
        rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
        rt.CellStyle.Spacing.All = 1
        rt.Cols.Count = 2
        rt.Cells(0,1).Text = "重量"
        rt.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
        rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
        rt.cols.Count = 11
        For r As Integer = 0 To 10
            rt.cols(i).width = 100 / 11
        Next
       
        Rows = Tables("表A.表B").Rows(i).DataRow.GetChildRows("表C")
        For r As Integer = 0 To Rows.Count - 1
            Dim rw As Integer = r \ 10
            Dim cl As Integer = r - rw * 10
            rt.Cells(rw + 1,cl + 1).Text = rows(r)("明细")
        Next
       
       
        For r As Integer = 1 To rt.Rows.Count - 1
            rt.Cells(r,0).text = r '逐行写入行号
        Next
       
        doc.Body.Children.Add(rt)
        rx = New prt.RenderText
        rx.Style.FontBold = True
        rx.Style.Spacing.Top = 3
        rx.Text = "总计: " & Tables("表A.表B").Rows(i)("重量")
        rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
        doc.Body.Children.Add(rx)
    Next
End With
doc.Preview


 


 回到顶部