Dim startdate As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim enddate As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
If User.Name.Trim() = "jichenggang@bdcom.com.cn" Then
Dim jcg As String = "(邮件通知 Like '%eponver@bdcom.com.cn%' or 邮件通知 like '%switchver@bdcom.com.cn%' or 邮件通知 like '%IEswitchver@bdcom.com.cn%')"
DataTables("临时版本跟踪表").LoadFilter = "需求提交时间 > '" & startdate.Value & "' And 需求提交时间 < '" & enddate.value.AddDays(1) & "' and (邮件通知 Like '%eponver@bdcom.com.cn%' or 邮件通知 like '%switchver@bdcom.com.cn%' or 邮件通知 like '%IEswitchver@bdcom.com.cn%')"
DataTables("临时版本跟踪表").Load
ElseIf User.Name.Trim() = "liujiyong@bdcom.com.cn" Then
DataTables("临时版本跟踪表").LoadFilter = "需求提交时间 > '" & startdate.Value & "' And 需求提交时间 < '" & enddate.value.AddDays(1) & "'"
DataTables("临时版本跟踪表").Load
End If
Dim dt As Table = Tables("临时版本跟踪表")
Dim filepath As String = "D:\临时版本跟踪表\" & startdate.Value & "-" & enddate.value & ".xls"
Dim nms() As String = {"临时版本编号","需求编号","博达机型","客户","需求提交时间","预计提供时间","开发环境","代码message","软件环境","show_version","技术支持邮箱","研发邮箱","客户期望交期","log","发布目录","测试目录","状态","状态直白"} '要导出的列名
Dim caps() As String = {"临时版本编号","需求编号","博达机型","客户","需求提交时间","预计提供时间","开发环境","代码message","软件环境","show_version","技术支持邮箱","研发邮箱","客户期望交期","log","发布目录","测试目录","状态","状态直白"} '对应的列标题
Dim szs() As Integer = {100,100,100,200,200,200,200,200,200,200,200,200,200,200,200,200,80,200} '对应的列宽
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim st As XLS.Style = Book.NewStyle '日期列的显示格式
st.Format = "yyyy-MM-dd hh:mm:ss"
For c As Integer = 0 To nms.length -1
Sheet(0, c).Value = caps(c) '指定列标题
Sheet.Cols(c).Width = szs(c) '指定列宽
If dt.Cols(nms(c)).IsDate Then '如果是日期列
Sheet.Cols(c).Style = st '设置显示格式
End If
Next
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
For c As Integer = 0 To nms.length -1
Sheet(r +1, c).Value = dt.rows(r)(nms(c))
Next
Next
Book.Save(filepath)
MessageBox.show("保存路径:" & FilePath,"导出成功",MessageBoxButtons.OK,MessageBoxIcon.Information)