Dim tb1 As winform.TextBox=e.Form.controls("TextBox1")
Dim g As New CrossTableBuilder("统计表1", DataTables("仓库"))
g.Filter = "[出库审核] = 1 and 出库单号 = '" & tb1.value & "' And [出库日期] ='" & Vars("StartDate") & "'"
g.HGroups.AddDef("供应商编码","SupplierNO")
g.HGroups.AddDef("送货单号","DeliveryNO")
g.HGroups.AddDef("出库单号","FormNO")
g.HGroups.AddDef("出库日期", DateGroupEnum.None,"DeliveryData")
g.HGroups.AddDef("采购订单号","MLSOrderNO")
g.HGroups.AddDef("物料编码","ItemNO")
g.HGroups.AddDef("规格型号","Model")
Dim tb As Table = Tables("报表查询_Table1")
tb.DataSource = g.BuildDataSource()
tb.AutoSizeCols()
Vars("报表") = "MLS"
Dim val1 As String = "001"
If FileSys.DirectoryExists("C:\MyFolde") Then '如果目录C:\MyFolder存在
If FileSys.FileExists("C:\MyFolde\" & Vars("报表") & Format(Date.Today(),"yyyyMMdd") & val1 & ".xls") Then
tb.SaveExcel("C:\MyFolde\" & Vars("报表") & Format(Date.Today(),"yyyyMMdd") & "002" & ".xls",Vars("报表"))
Else
tb.SaveExcel("C:\MyFolde\" & Vars("报表") & Format(Date.Today(),"yyyyMMdd") & "001" & ".xls",Vars("报表"))
End If
MessageBox.Show("已生成C:\MyFolde\" & Vars("报表") & Format(Date.Today(),"yyyyMMdd") & ".xls!", "提示")
Else
FileSys.CreateDirectory("C:\MyFolde")
tb.SaveExcel("C:\MyFolde\" & Vars("报表") & Date.Today() & ".xls",Vars("报表"))
MessageBox.Show("已生成C:\MyFolde\" & Vars("报表") & Format(Date.Today(),"yyyyMMdd") & "001" & ".xls!", "提示")
End If
这里保存的是EXCEL格式的,我要csv格式的