//
// //
// Blob数据转换为文件函数 //
// 参数: blob1:blob类型数据,file1:文件名 //
// 返回值: 1表示成功 -1表示失败 //
// //
//
integer li_FileNum,loops,i
long blen, bytes_read
blob b
SetPointer(HourGlass!)
try
if FileExists(file1) then
blen = 0
SetFileAttributes(file1,blen)
if not FileDelete(file1) then
messagebox('操作系统错误','无法进行进一步的处理!~r~n~r~n建议您妥善保存文件,然后重新启动计算机,或杀除WINWORD进程。')
return -1
end if
end if
blen = len(blob1)
li_FileNum = FileOpen(file1, StreamMode!, Write!)
if li_FileNum = -1 then return -1
if blen > 32765 then
if Mod(blen, 32765) = 0 then loops = blen/32765 else loops = (blen/32765) + 1
else
loops = 1
end if
for i = 1 to loops
b = BlobMid(blob1,(i - 1) * 32765 + 1, 32765)
bytes_read = FileWrite(li_FileNum, b)
// w_mdi.setmicrohelp('write ' + file1 + ':' + string(i/loops))
next
//w_mdi.setmicrohelp('File closed')
FileClose(li_FileNum)
SetPointer(Arrow!)
catch(throwable thab)
gf_exception("gf_file_from_blob",thab.text)
end try
return 1
// //
// Blob数据转换为文件函数 //
// 参数: blob1:blob类型数据,file1:文件名 //
// 返回值: 1表示成功 -1表示失败 //
// //
//
integer li_FileNum,loops,i
long blen, bytes_read
blob b
SetPointer(HourGlass!)
try
if FileExists(file1) then
blen = 0
SetFileAttributes(file1,blen)
if not FileDelete(file1) then
messagebox('操作系统错误','无法进行进一步的处理!~r~n~r~n建议您妥善保存文件,然后重新启动计算机,或杀除WINWORD进程。')
return -1
end if
end if
blen = len(blob1)
li_FileNum = FileOpen(file1, StreamMode!, Write!)
if li_FileNum = -1 then return -1
if blen > 32765 then
if Mod(blen, 32765) = 0 then loops = blen/32765 else loops = (blen/32765) + 1
else
loops = 1
end if
for i = 1 to loops
b = BlobMid(blob1,(i - 1) * 32765 + 1, 32765)
bytes_read = FileWrite(li_FileNum, b)
// w_mdi.setmicrohelp('write ' + file1 + ':' + string(i/loops))
next
//w_mdi.setmicrohelp('File closed')
FileClose(li_FileNum)
SetPointer(Arrow!)
catch(throwable thab)
gf_exception("gf_file_from_blob",thab.text)
end try
return 1