在Fox中生成"分栏"表,根据此表生成Excel报表:
Dim jb As New SQLJoinTableBuilder("分栏","表A")
jb.AddCols("姓名","金额")
jb.AddExp("姓名1","姓名")
jb.AddExp("金额1","金额")
jb.build
Dim t1,t2 As Table
t1 = Tables("表A")
t2 = Tables("分栏")
t2.DataTable.DataRows.Clear
Dim n As Integer = t1.DataTable.Compute("count(金额)","姓名 is not null")
t2.AddNew(Math.Ceiling(n/2))
For n = 0 To t2.Rows.count-1
t2.Rows(n)("姓名") = t1.Rows(2*n)("姓名")
t2.Rows(n)("金额") = t1.Rows(2*n)("金额")
t2.Rows(n)("姓名1") = t1.Rows(2*n+1)("姓名")
t2.Rows(n)("金额1") = t1.Rows(2*n+1)("金额")
Next
[此贴子已经被作者于2011-9-3 11:42:39编辑过]