以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]报表打印代码慰问 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=5826) |
||||
-- 作者:舜风 -- 发布时间:2010/1/20 22:56:00 -- [求助]报表打印代码慰问
[此贴子已经被作者于2010-1-20 23:49:32编辑过]
|
||||
-- 作者:mr725 -- 发布时间:2010/1/20 23:45:00 -- Tables("退休慰问费").Filter = "[是否停发] = False and [单位] = \'" & Ary & "\'" |
||||
-- 作者:舜风 -- 发布时间:2010/1/20 23:54:00 -- 以下是引用mr725在2010-1-20 23:45:00的发言:
Tables("退休慰问费").Filter = "[是否停发] = False and [单位] = \'" & Ary & "\'" 谢谢,说明里没有实例,所以没法真正理解For Each ……Next |
||||
-- 作者:yangming -- 发布时间:2010/1/21 0:30:00 -- 看EXCEL的分组报表
[此贴子已经被作者于2010-1-21 0:48:04编辑过]
|
||||
-- 作者:舜风 -- 发布时间:2010/1/21 9:29:00 -- 以下是引用yangming在2010-1-21 0:30:00的发言:
看EXCEL的分组报表
[此贴子已经被作者于2010-1-21 0:48:04编辑过] 杨版,分组报表简单实用,按钮代码也简单,但在有多地方却不适合 [此贴子已经被作者于2010-1-21 9:30:54编辑过]
|
||||
-- 作者:yangming -- 发布时间:2010/1/21 12:12:00 -- 使用分组打印前,先对单位进行排序 |
||||
-- 作者:yangming -- 发布时间: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") |