if value=1 then
lb_exist=FileExists(file_path)
if lb_exist=true then
re_me=messagebox('保存','此文件已存在,是否覆盖它?',question!,yesno!,2)
if re_me=1 then
r_i=dw_x.SaveAsAscii(file_path)
else
return
end if
else
r_i=dw_x.SaveAsAscii(file_path)
end if
end if
if r_i=1 then
messagebox('提示','保存成功!')
else
messagebox('提示','保存失败!')
return
end if
//创建新的Word对象并连接到该对象上
long result
result=ole_word.ConnectToNewObject("Word.Application")
IF result<> 0 THEN
Destroy ole_word
MessageBox('错误','无法创建word对象!')
return 1
END IF
ole_word.Visible =true
long l_colnum,l_rownum
constant long wdWord9TableBehavior = 1
constant long wdAutoFitFixed = 0
string str_colname
string str_value
integer i,j
//插入标题头的名字到Word文档
for i = 1 to l_colnum
str_colname = dw_print.describe('#' + string(i) + ".name") + "_t"
str_value = dw_print.describe(str_colname + ".text")
ole_word.Selection.TypeText(trim(str_value))
ole_word.Selection.MoveRight(12)
next
dw_print.setredraw(false)
ole_word.Selection.MoveLeft(12)
//插入数据窗口中的数据到Word文档
for i = 2 to l_rownum
for j = 1 to l_colnum
dw_print.scrolltorow(i - 1)
dw_print.setcolumn(j)
str_value =dw_print.gettext()
ole_word.Selection.MoveRight(12)
ole_word.Selection.TypeText(str_value)
next
next
dw_print.setredraw(true)
integer li_ret
li_ret = ole_object.ConnectToObject("","Excel.Application")
IF li_ret <> 0 THEN
li_ret = ole_object.ConnectToNewObject("Excel.Application")
IF li_ret <> 0 THEN
messagebox("OLE错误","OLE无法连接!~r~n错误号:" + string(li_ret))
Return 0
END IF
ole_object.visible = False
END IF
//转换标题头为中文,标题头命名应该为列名+"_t"形式
for j = 1 to ll_column
ls_colname[j] = dw_print.describe("#"+string(j)+".name")
ls_value = dw_print.describe(ls_colname[j]+"_t"+".text")
//ole_object.activesheet.cells[1,j].value = ls_value 开始的方法
SetRemote("R1C"+STRING(J), ls_value, handle)
next
//将下拉数据窗口数据值转化为显示值,数据量大时比现用方法速度慢
//If ll_column > 0 Then
// For j = 1 To ll_column
// If dw_print.Describe("#" + String(j) + ".edit.style") = 'dddw' Then
// for i=1 to ll_rowumn - 1
// SetRemote("R"+STRING(i+1)+"C"+STRING(J),dw_print.Describe("Evaluate('LookUpDisplay(#"+string(j)+")',"+string(i)+")"), handle)
// next
// end if
// next
//end if