//==============================================================================
// 函数: 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 then
messagebox('提示',"当前数据窗无记录数据,无导出的必要!",exclamation!)
return false
end if
ll_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) THEN
ll_return = messagebox('提示', ls_pathname+"已经存在,是否覆盖?",Question!, YesNo!)
if ll_return=2 then return false
end if
ls_ext = trim(right(ls_pathname,3))
if ls_ext = 'txt' then
ll_return = adw_source.saveasascii(ls_pathname)
ai_type =1
elseif ls_ext = 'csv' then
ll_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 if
IF ll_return <>1 then
messagebox('错误',"导出数据失败!",stopsign!)
return false
END IF
messagebox('提示',"已成功导出【"+string(adw_source.rowcount())+"】条数据;~r~n 文件位置"+ls_pathname)
return true
数据窗口dw导出多种格式文件
最新推荐文章于 2023-06-20 00:22:44 发布