导出按钮事件Dim Book As New XLS.Book(ProjectPath & "Attachments\成绩录入.xls")
Dim fl As String = "c:\成绩录入_临时.xls"
Dim xuenian As WinForm.TextBox = e.Form.Controls("学年")
Dim xueqi As WinForm.ComboBox = e.Form.Controls("学期")
Dim leixing As WinForm.ComboBox = e.Form.Controls("考试类型")
If xuenian.Text="" Or xueqi.Text="" Or leixing.Text="" Then
MessageBox.Show("你还没设置好考试的标识信息!", "警 告")
Else
MessageBox.Show("填写好成绩后请保存并关闭文件后使用导入功能把结果导入数据库!","提示")
Dim dh_xueqi
Dim dh_leixing
If xueqi.Text = "第一学期" Then
dh_xueqi = "1"
ElseIf xueqi.Text = "第二学期" Then
dh_xueqi = "2"
End If
If leixing.Text = "期中考试" Then
dh_leixing = "1"
ElseIf leixing.Text = "期末考试" Then
dh_leixing = "2"
End If
Vars("成绩标识码") = xuenian.Text & dh_xueqi & dh_leixing
Book.Marks.Add("成绩标识码",Vars("成绩标识码"))
Book.Marks.Add("学年",xuenian.Text)
Book.Marks.Add("学期",xueqi.Text)
Book.Marks.Add("考试类型",leixing.Text)
Book.Build()
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()
End If
报表BuildDetail事件
Select Case e.Book.TempLate
Case "成绩录入"
If e.DataRow IsNot Nothing Then
e.Book.Marks("成绩标识码") = Vars("成绩标识码") & e.DataRow("学生标识码")
End If
End Select