以下是引用狐狸爸爸在2009-2-18 9:54:00的发言:
Dim Arys As List(Of String())
Arys = DataTables("工资").GetUniqueValues("", "所在单位","所在部门")
For Each Ary As String() In Arys
With Tables("工资")
.Filter = 条件
.Select(0,0,.Rows-1,.Cols-1)
'打印excel报表的代码
End With
Next
Tables("工资") = ""
[此贴子已经被作者于2009-2-18 9:54:01编辑过]
问题一:如果依 .Select(0,0,.Rows-1,.Cols-1) 会提示错误代码
问题二:最后的 Tables("工资") = "" 是什么意思?不懂
我现设置如下(当然是错误的代码,请高手帮我完善):Dim Arys As List(Of String())
Arys = DataTables("当月在职工资表").GetUniqueValues("", "所在单位","所在部门")
For Each Ary As String() In Arys
With Tables("当月在职工资表")
.Filter = "[是否停发] = False"
.Select(0,0,.Rows.Count -1,.Cols.Count -1)
Dim Book As New XLS.Book(ProjectPath & "Attachments\工资.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build()
Book.Save(ProjectPath & "Reports\工资.xls")
Dim Proc As New Process
Proc.File = ProjectPath & "Reports\工资.xls"
Proc.Start()
End With
Next
Dim Arys As List(Of String())
Arys = DataTables("当月在职工资表").GetUniqueValues("", "所在单位","所在部门")
For Each Ary As String() In Arys
With Tables("当月在职工资表")
.Filter = "[是否停发] = False And [所在单位] = Ary(0) And [所在部门] = Ary(1)"
.Select(0,0,.Rows.Count -1,.Cols.Count -1)
Dim Book As New XLS.Book(ProjectPath & "Attachments\工资.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build()
Book.Save(ProjectPath & "Reports\工资.xls")
Dim Proc As New Process
Proc.File = ProjectPath & "Reports\工资.xls"
proc.Verb = "Print"
Proc.Start()
End With
Next
应用他爸给的代码测试,感觉却越来越糊涂 ,连报表也不知如何设置了
上传测试文件,再次请教
和代码无关吧,你就是通过菜单直接打印,也是有问题的。
是你的excel报表设计有问题,你看一下excel报表的基础部分,尝试修改一下,搞不定再来留言。
此主题相关图片如下:未命名.jpg
我也认为可能是报表问题,基础部分看了很多遍,就是搞不定
(如上设置,从逻辑上也有问题,应该是不能自动分组;
再如:[Sum(实际收入)] 看似没有问题,可却不能统计,郁闷)
[此贴子已经被作者于2009-3-15 19:29:56编辑过]
呵呵。才看见报表统计错误 [Sum(实际收入)] 应为
[%Sum(实际收入)]
可还是不知如何分组