PB 导出Excel

Int li_return;
li_return = g_var.failure;

string ls_pathname,ls_file,ls_ext
long ll_return
if adw_1.rowcount()<1 then

as_error = '当前数据窗无记录数据可导出'
return  li_return

end if

ll_return=getfilesavename("导出文件",ls_pathname,ls_file,"xls","xls文件(.xls),.xls,txt文件(.txt),.txt,csv文件(.csv),.csv" )

if ll_return<>1 then return li_return
IF fileexists(ls_pathname) THEN

ll_return = messagebox('提示', ls_pathname+"已经存在,是否覆盖?",Question!, YesNo!)
if ll_return = 2 then return li_return

end if

ls_ext = trim(right(ls_pathname,3))
if ls_ext = 'txt' then

ll_return = adw_1.saveasascii(ls_pathname)

elseif ls_ext = 'csv' then

ll_return = adw_1.saveasascii(ls_pathname)//,csv!,true)

elseif ls_ext = 'xls' then

ll_return = adw_1.saveasascii(ls_pathname)//,Excel!,true)    

end if

IF ll_return <>1 then

as_error = '导出数据失败'
return li_return

END IF

as_error = "已成功导出【"+string(adw_1.rowcount())+"】条数据;~r~n 文件位置"+ ls_pathname;
Return g_var.success;

你可能感兴趣的:(pbr)