/*
string null_str
SetNull(null_str)
dw_3.ImportFile(null_str)
*/
/*
OLEObject ExcelServer
long excelok
string str_savename ,str_filename
ExcelServer = CREATE OLEObject
string ls_name,ls_pathname
boolean lb_exist
integer li_rtn
if ExcelServer.connecttonewobject(“Excel.application”) < 0 then
messagebox(“系統提示”,”沒有安裝Excel”)
destroy(ExcelServer)
return
end if
li_rtn= GetFileSaveName(“打開文件”,str_filename,ls_name,”xls”,”Excel文件(*.xls),*.xls”)
if li_rtn=1 then
ExcelServer.Workbooks.Open(str_filename)
str_savename= “c:\temp.txt”
excelserver.activeworkbook.saveas(str_savename,3)
excelserver.displayalerts=false
ExcelServer.quit()
ExcelServer.DisconnectObject()
//DESTROY ExcelServer
dw_3.ImportFile(str_savename)
filedelete(str_savename)
END IF
DESTROY ExcelServer
*/
string str_savename,named,s_grxh
int excelok,li_net
long li_count,i
oleobject excelserver
excelserver=create oleobject
excelok=excelserver.connecttonewobject(“excel.application”)
//检查返回值,以确保已成功地连接到了Excel
if excelok<> 0 then
messagebox(“信息提示”,”连接EXCEL失败,请检查计算机中是否安装了EXCEL!”)
return -1
end if
li_net = GetFileOpenName(“选择文件”, str_savename,named,”xls”,”Excel文件(*.xls),*.xls”)
if li_net > 0 then
if str_savename = “” then return -1
dw_3.settransobject(sqlca)
dw_3.reset()
excelserver.workbooks.open(str_savename)
excelserver.activesheet.cells.copy
li_count = dw_3.importclipboard(2) //导入数据
clipboard(“”)
excelserver.quit()
excelserver.disconnectobject()
destroy excelserver
return 1
else
messagebox(‘信息提示’,’没有指定导入文件!’)
return -1
end if
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/36006.html