我利用ole控件实现word 和excel文件的存储和查看功能,以前用office2003没问题,现在用office2007 以后,附件打开后读不到内容,求高手帮忙
附部分代码
文件上传模块
long ll_row
if this.rowcount() > 0 then
ll_row = this.getrow()
string ls_docname,ls_named
choose case dwo.name
case "b_2"
int li_result
//将图片显示在图片控件中
integer li_fileptr//用作打开的文件号
long ll_filelen//存储文件的长度
integer li_loops //存储循环次数
integer i //用作循环的变量
long ll_bytes_read,ll_new_pos
//迫不得已的多定义出这两个变量来,否则第二次选择图片时lbb_read,lbb_total就不能清除
blob lbb_read2,lbb_total
li_result=getfileopenname("打开文件",ls_docname,ls_named,"rtf",&
"doc files(*.doc),*.doc,"&
+"text files(*.txt),*.txt,"&
+"jpg files(*.jpg),*.jpg,"&
+"rtf files(*.rtf),*.rtf,"&
+"bmp files(*.bmp),*.bmp,"&
+"all files(*.*),*.*")
long ll
ll=filelength(ls_docname)
li_fileptr=fileopen(ls_docname,streammode!,read!,lockread!) //打开该文件
if li_fileptr= - 1 then
beep(2)
// messagebox("信息提示!","图形文件打开错误!")
return
end if
//获取文件的长度
ll_filelen=500000000
if ll > 32766 then
li_loops=((ll - 1)/32766) + 1 //计算需要重复读取的次数
else
li_loops=1
end if
for i= 1 to li_loops //循环读取
ll_bytes_read=fileread(li_fileptr,lbb_read2)
lbb_total=lbb_total+lbb_read2
ll_new_pos=ll_new_pos+ll_bytes_read
fileseek(li_fileptr,ll_new_pos,frombeginning!)
next
fileclose(li_fileptr)
setpointer(hourglass!)
setpointer(arrow!)
lbb_array[ll_row]=lbb_total
end choose
end if
打开文件
if dw_1.rowcount() > 0 then
dw_1.oleactivate(dw_1.getrow(),"blob_1",0)
end if
------解决方案--------------------
打开文件
if dw_1.rowcount() > 0 then
dw_1.oleactivate(dw_1.getrow(),"blob_1",0) //这么代码好像不对吧?
end if