Foxtable(狐表)用户栏目专家坐堂 → [求助]怎么保存为CSV格式的文件


  共有5406人关注过本帖树形打印复制链接

主题:[求助]怎么保存为CSV格式的文件

帅哥哟,离线,有人找我吗?
zhjun2017
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:20 积分:247 威望:0 精华:0 注册:2017/8/10 8:10:00
[求助]怎么保存为CSV格式的文件  发帖心情 Post By:2017/9/13 13:42:00 [显示全部帖子]

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格式的

 回到顶部