Foxtable(狐表)用户栏目专家坐堂 → [求助]报表打印代码慰问


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

主题:[求助]报表打印代码慰问

美女呀,离线,留言给我吧!
yangming
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:4109 积分:23338 威望:0 精华:21 注册:2008/9/1 20:07:00
  发帖心情 Post By:2010/1/21 0:30:00 [显示全部帖子]

看EXCEL的分组报表
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:慰问费.rar

[此贴子已经被作者于2010-1-21 0:48:04编辑过]

 回到顶部
美女呀,离线,留言给我吧!
yangming
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:4109 积分:23338 威望:0 精华:21 注册:2008/9/1 20:07:00
  发帖心情 Post By:2010/1/21 12:12:00 [显示全部帖子]

使用分组打印前,先对单位进行排序

 回到顶部
美女呀,离线,留言给我吧!
yangming
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:超级版主 帖子:4109 积分:23338 威望:0 精华:21 注册:2008/9/1 20:07:00
  发帖心情 Post By:2010/1/21 16:39:00 [显示全部帖子]

专业报表

Tables("退休慰问费").OpenView("1")
Dim doc As New PrintDoc
Dim rt As Prt.RenderTable
Dim rx,rx1,rx2 As prt.RenderText
Dim Agg As New prt.DataBinding.Aggregate("GroupSum")
Dim tbl As Table = Tables("退休慰问费")
Dim ColNames As New List(Of String)
Dim Rows As List(Of DataRow)
Dim Regions As List(Of String) = tbl.DataTable.GetUniqueValues("","慰问单位")
For Each cl As Col In tbl.Cols '排除隐藏列
    If cl.Visible Then
        ColNames.Add(cl.Name)
    End If
Next
For Each Region As String In Regions
    rx1 = New prt.RenderText
    rx1.Style.FontSize = 14
    rx1.Style.FontBold = True
    rx1.Style.Spacing.Bottom = 2
    rx1.Text = "退休慰问费"
    rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center
    doc.Body.Children.Add(rx1)
    rx = New prt.RenderText
    rx.Style.FontSize = 11
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 2
    rx.Text = "  慰问单位: " & Region & " ".PadLeft(90) & " 单位: 元"
    doc.Body.Children.Add(rx)
    rt = New prt.RenderTable
    rt.Style.Font = Tables("退休慰问费").Font
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Style.GridLines.All = New prt.LineDef(0.3,Color.LightGray)
    rt.Style.Spacing.Bottom = 5
    rt.CellStyle.Spacing.All = 1
    rt.Style.Font = tbl.Font
   
    Rows = tbl.Datatable.Select("[是否停发] = False and [慰问单位] = '" & Region & "'")
   
    For c As integer = 0 To ColNames.Count - 1 '逐列设置和填入内容
       
        rt.Cells(0,c).Text = ColNames(c) '列名作为标题
       
        rt.Cols(c).Width = tbl.Cols(ColNames(c)).PrintWidth
        For r As integer = 0 To Rows.Count -1
            rt.Cells(r + 1, c).Text = Rows(r)(ColNames(c))
           
        Next
    Next

    rt.Rows.Count = rt.Rows.Count + 1
    Dim cnt As integer = rt.Rows.Count - 1
    rt.Cells(cnt,0).Text = "总计"
    For c As Integer = 0 To ColNames.Count - 1 '逐列设置和填入内容
        If tbl.Cols(ColNames(c)).IsNumeric then
            rt.Cells(cnt,c).Text = tbl.Compute("Sum("& ColNames(c) & ")","[是否停发] = False and [慰问单位] = '" & Region & "'")
        End If
    Next
    rt.Cells(cnt+1,0).SpanCols = ColNames.Count

        rt.Cells(cnt+1,0).Text = "单位负责人:" & " ".PadLeft(16) & "人事负责人:"& " ".PadLeft(16) & "制表人:"
    rt.Cells(cnt+1,0).Style.GridLines.Bottom = New prt.LineDef(Color.White)
    rt.Cells(cnt+1,0).Style.GridLines.Left = New prt.LineDef(Color.White)
    rt.Cells(cnt+1,0).Style.GridLines.Right = New prt.LineDef(Color.White)
    rt.Rows(cnt+1).Style.Font = New Font("宋体",11, FontStyle.Bold)
        doc.Body.Children.Add(rt)
Next
doc.preview()
Tables("退休慰问费").OpenView("2")

 回到顶部