数据窗口dw导出多种格式文件
生活随笔
收集整理的這篇文章主要介紹了
数据窗口dw导出多种格式文件
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
//==============================================================================
// 函數: uf_dw_exportall()
//------------------------------------------------------------------------------
// 描述:
//------------------------------------------------------------------------------
// 參數:
// datawindow adw_source 數據
// string as_folder 文件夾名稱:保存文件的文件夾
// string as_filename 文件名
//------------------------------------------------------------------------------
// 返回值: boolean
//------------------------------------------------------------------------------
// 作者: chenzj 日期: 2021.12.02
//------------------------------------------------------------------------------
// 修改歷史:
//
//==============================================================================//dw_1.SaveAs("D:\Desktop\111.txt", Text!, false)string ls_pathname,ls_file,ls_ext
long ll_return
if adw_source.rowcount()<1 thenmessagebox('提示',"當前數據窗無記錄數據,無導出的必要!",exclamation!)return false
end ifll_return=getfilesavename("導出文件",ls_pathname,ls_file,"txt","txt文件(*.txt),*.txt,csv文件(*.csv),*.csv,xls文件(*.xls),*.xls" )if ll_return<>1 then return false
IF fileexists(ls_pathname) THENll_return = messagebox('提示', ls_pathname+"已經存在,是否覆蓋?",Question!, YesNo!)if ll_return=2 then return false
end ifls_ext = trim(right(ls_pathname,3))
if ls_ext = 'txt' thenll_return = adw_source.saveasascii(ls_pathname)ai_type =1
elseif ls_ext = 'csv' thenll_return = adw_source.saveasascii(ls_pathname)//,csv!,true)ai_type =2
elseif ls_ext = 'xls' then// ll_return = adw_source.saveasascii(ls_pathname)//,Excel!,true) ll_return = gf_dw_to_excel(adw_source,ls_pathname)ai_type =3
end ifIF ll_return <>1 thenmessagebox('錯誤',"導出數據失敗!",stopsign!)return false
END IF
messagebox('提示',"已成功導出【"+string(adw_source.rowcount())+"】條數據;~r~n 文件位置"+ls_pathname)return true
總結
以上是生活随笔為你收集整理的数据窗口dw导出多种格式文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 前端学习(2697):重读vue电商网站
- 下一篇: 工作64:element多选功能