Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Excel報表現在可算比較完美了,唯一缺點就是沒有對指定列合併相同單元格功能,唯有自己想法解決,下面的代碼基於模板,對第一,第二列的"序號"及"定額編號"合併相同單元格(沒有考慮跨頁合併)
Dim Ta As Table = Tables("材料分析")
Dim Tt1 As String = ProjectPath & "Attachments\"
Dim Tt2 As String = ProjectPath & "reports-:special:1:-
If Ta.Rows.Count > 0 Then
Ta.Select(0,1,Ta.Rows.count-1,1)
Dim Book As New XLS.Book(Tt1 & "詳細分析.xls") '打开模板
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Book.Build() '生成细节区
Book.Save(Tt2 & "詳細分析.xls")
Dim i,n,sum As Integer
Dim Book1 As New XLS.Book(Tt2 & "詳細分析.xls")
Dim Sheet1 As XLS.Sheet = Book1.Sheets(0)
Dim Ls,Ls1 As String
For i = 0 to Ta.Rows.count-1
If Ls = nothing Then
Ls ="," & Ta.Rows(i)("序號")
Ls1 ="," & Ta.Rows(i)("定額編號")
ElseIf Ls.IndexOf(Ta.Rows(i)("序號"))=-1 Then
Ls = Ls & "," & Ta.Rows(i)("序號")
ElseIf Ls1.IndexOf(Ta.Rows(i)("定額編號"))=-1 Then
Ls1 = Ls1 & "," & Ta.Rows(i)("定額編號")
End If
Next
For i = 1 to Ls.split(",").Length-1
n = Ta.Compute("count(序號)","序號 = " & Ls.split(",")(i))
sum = sum+n
Sheet1.MergeCell(sum-n+3,0,n,1)
Next
sum = 0
For i = 1 to Ls1.split(",").Length-1
n = Ta.Compute("count(定額編號)","定額編號 = '" & Ls1.split(",")(i) & "'")
sum = sum+n
Sheet1.MergeCell(sum-n+3,1,n,1)
Next
Book1.Save(Tt2 & "詳細分析.xls")
Dim Proc1 As New Process
Proc1.File = Tt2 & "詳細分析.xls"
Proc1.Start()
End If
Ta.Select(1,1,1,1)
人家那里不认简体