以二进制流的方式操作。world文档等文档要导出成文件,然后用api打开。
一个函数
integer li_filenum,li_loops,li_counter
long ll_filelen,ll_butes_read,ll_new_pos
blob lb_our_blob,lb_tot_b,lb_temp
setnull(lb_tot_b)
ll_filelen = fileLength(ls_filepath)
li_filenum = fileopen(ls_filepath,streammode!,read!,lockread!)
if ll_filelen > 32765 then
li_loops = ((ll_filelen - 1)/ 32765) + 1
else
li_loops = 1
end if
for li_counter = 1 to li_loops
ll_butes_read = fileRead(li_filenum,lb_our_blob)
if li_counter=1 then
lb_tot_b = lb_our_blob
else
lb_tot_b = lb_tot_b +lb_our_blob
end if
ll_new_pos = ll_new_pos + ll_butes_read
fileseek(li_filenum,ll_new_pos,frombeginning!)
next
fileclose(li_filenum)
return lb_tot_b
//函数结束,然后用updateblob保存进数据库
//导出成文件,先用getfilesavename函数
另一个函数
integer li_loops,li_counter,li_filenum,li_rtn
long ll_filelen
ll_filelen = len(lb_content)
if ll_filelen = 0 then
messagebox('提示信息',"源文件不存在!")
return 0
end if
if fileexists(ls_path) then
li_rtn = messagebox('提示信息',"目标文件已存在,是否覆盖?",question!,Yesno!,1)
if li_rtn = 1 then
filedelete(ls_path)
else
return 0
end if
end if
if fileexists(ls_path) then
messagebox('提示信息',"目标文件无法删除,请手工删除后再执行此程序!")
return 0
end if
if ll_filelen > 32765 then
li_loops = ((ll_filelen - 1)/ 32765) + 1
else
li_loops = 1
end if
li_filenum = fileopen(ls_path,streammode!,write!,shared!,append!)
for li_counter = 1 to li_loops
filewrite(li_filenum,blobmid(lb_content,32765 * (li_counter - 1) + 1,32765))
next
fileclose(li_filenum)
messagebox('提示信息',"文件保存成功!")
return 1
//保存函数
api打开文件函数
Function long ShellExecuteA (long hwnd, string lpOperation ,String lpFile, String lpParameters, String lpDirectory, Long nShowCmd) Library "shell32.dll"
以上是我用到的没有修改,你融会贯通吧。自己修改