If e.Form.Controls("ComboBox2").value= "10月报表" Then
Dim dt As DataTable = DataTables("表名")
Dim rq_b As Date = e.Form.Controls("datetimepicker2").value
Dim rq_e As Date = e.Form.Controls("datetimepicker3").value
Dim Book As New XLS.Book(ProjectPath & "Attachments\报表.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\报表.xls"
Dim Sheet As XLS.Sheet = Book.Sheets("1")
Sheet(0,17).Value = rq_e
Sheet(7,1).Value = "aa"
Sheet(8,1).Value = "bb"
Sheet(9,1).Value = "cc"
Sheet(10,1).Value = "dd"
Sheet(11,1).Value = "ee"
Sheet(12,1).Value = "ff"
Sheet(6,2).Value =dt.Compute("Sum(登记人数)"," [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(7,2).Value =dt.Compute("Sum(登记人数)","[站名]='aa' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(8,2).Value =dt.Compute("Sum(登记人数)","[站名]='bb' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(9,2).Value =dt.Compute("Sum(登记人数)","[站名]='cc' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(10,2).Value =dt.Compute("Sum(登记人数)","[站名]='dd' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(11,2).Value =dt.Compute("Sum(登记人数)","[站名]='ee' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(12,2).Value =dt.Compute("Sum(登记人数)","[站名]='ff' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(14,2).Value =dt.Compute("Sum(登记人数)","[报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(15,2).Value =dt.Compute("Sum(登记人数)","[报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(6,3).Value =dt.Compute("Sum(测血压人数)"," [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(7,3).Value =dt.Compute("Sum(测血压人数)","[站名]='aa' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(8,3).Value =dt.Compute("Sum(测血压人数)","[站名]='bb' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(9,3).Value =dt.Compute("Sum(测血压人数)","[站名]='cc' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(10,3).Value =dt.Compute("Sum(测血压人数)","[站名]='dd' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(11,3).Value =dt.Compute("Sum(测血压人数)","[站名]='ee' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(12,3).Value =dt.Compute("Sum(测血压人数)","[站名]='ff' and [报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(14,3).Value =dt.Compute("Sum(测血压人数)","[报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
Sheet(15,3).Value =dt.Compute("Sum(测血压人数)","[报告日期]>='" & rq_b & "' And [报告日期]<='" & rq_e & "'")
……
……
有很多条这样的代码,用于构建excel报表。请高手帮助一下,有没有什么方法精简一下?或者有没有其他的思路,更正确实现?
本人刚接触foxtable这个软件,觉得很实用。但是不会编程,请高手帮忙,万分感谢!