Dim tb As new DataTableBuilder("临时表")
tb.AddDef("姓名",Gettype(String),20)
tb.adddef("时间",Gettype(Integer))
tb.AddDef("阅卷",Gettype(Integer))
tb.Build()
Dim dt As DataTable = DataTables("临时表")
Dim dr As DataRow
For Each r1 As Row In Tables("考试").Rows
For Each c As Col In Tables("考试").Cols
Dim name As String = r1(c.Name)
If name.Length<=6 Then
dr = dt.Find("姓名='" & name & "'")
If dr Is Nothing Then
dr = dt.AddNew()
dr("姓名") = name
End If
Dim r As Row=Tables("考试").Rows(0)
Dim str As String
str=System.Text.RegularExpressions.Regex.Replace(r(c.Name), "[^0-9:\-:]", "")
Dim d1 As Date = str.split("-")(0)
Dim d2 As Date = str.split("-")(1)
Dim sp As TimeSpan = d2-d1
dr("时间") =dr("时间")+sp.TotalMinutes/6
dr("阅卷")=30
End If
Next
Next
DataTables("临时表").DeleteFor("姓名 is null")
dr=dt.AddNew
dr("姓名")="合计"
dr("时间")=DataTables("临时表").Compute("sum(时间)")
dr("阅卷")=DataTables("临时表").Compute("sum(阅卷)")
Dim Book As New XLS.Book(ProjectPath & "Attachments\考试报表.xls")
Dim fl As String = ProjectPath & "Reports\考试报表.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Verb = "Print" '指定动作
Proc.Start()