文档库 最新最全的文档下载
当前位置:文档库 › 导出openoffice

导出openoffice

long ll_cols,ll_rows,ret,ll_post,l,n = 0
long ll_pos[],k = 0
long c = 0 //癘魁糶ゅンい璸衡┪计
integer li_file,i,j
string ls_path,ls_doc,ls_string,ls_text,ls_objs,ls_obj,ls_type,ls_data,ls_colname
string ls_computer[] //detailい璸衡办
boolean lb_have = false
if isvalid(ads_data) then
ls_objs = ads_data.describe("datawindow.objects")
ll_post = pos(ls_objs,'~t')
/*т计沮怠癸禜い┮Τdetailい璸衡办nameの﹚*/
do while ll_post > 0
ls_obj = mid(ls_objs,1,ll_post - 1)
ls_objs = mid(ls_objs,ll_post + 1)
//detailい璸衡办
if ads_data.describe(ls_obj + '.type') = 'compute'&
and ads_data.describe(ls_obj + '.band') = 'detail' then
k++
ll_pos[k] = long(ads_data.describe(ls_obj + '.tag')) //璸衡办﹚
ls_computer[k] = ls_obj //璸衡办name
end if
ll_post = pos(ls_objs,'~t')
loop
//耞程癸禜
ls_obj = ls_objs
if ads_data.describe(ls_obj + '.type') = 'compute' &
and ads_data.describe(ls_obj + '.band') = 'detail' then
k++
ll_pos[k] = long(ads_data.describe(ls_obj + 'tag'))
ls_computer[k] = ls_obj
end if
ll_cols = long(ads_data.describe("datawindow.column.count")) + k
ll_rows = ads_data.rowcount()
if ll_cols = 0 or ll_rows = 0 then
return - 1
else
ret = GetFileSaveName("玂",ls_path,ls_doc, "SLK","SLK EXCEL(*.slk),*.slk")
if ret = 1 then
li_file = Fileopen(ls_doc,LineMode!,Write!,LockWrite!,Replace!)
if li_file > 0 then
ls_string = 'ID;PSCALC3'
FileWrite(li_file,ls_string)
for i = 1 to ll_cols
for l = 1 to k
if i = ll_pos[l] then
lb_have = true
exit
else
lb_have = false
end if
next
if lb_have then
ls_text = ads_data.describe(ls_computer[l] + '_t.text')
if ls_text <> '!' then
ls_string = 'C;Y1;X' + string(i - n) + ';K"' + ls_text + '"'
FileWrite(li_file,ls_string)
ls_type = lower(ads_data.describe(ls_computer[l] + '.coltype'))
for j = 1 to ll_rows
//沮璸衡办计沮摸匡拒ㄧ计
choose case ls_type
case 'char'
ls_data = ads_data.getitemstring(j,ls_computer[l])
ls_string = 'C;Y' + string(j + 1) + ';X' + string(i - n) + ';K"'+ ls_data + '"'
FileWrite(li_file,ls_string)
case 'datetime'
ls_data = string(ads_data.getitemdatetime(j,ls_computer[l]))
ls_string = 'C;Y' + string(j + 1) + ';X' + string(i - n) + ';K"'+ ls_data + '"'
FileWrite(li_file,ls_string)
case 'time','timestamp'
ls_data = string(ads_data.getitemtime(j,ls_computer[l]))
ls_string = 'C;Y' + string(j + 1) + ';X' + string(i - n) + ';K"

'+ ls_data + '"'
FileWrite(li_file,ls_string)
case 'date'
ls_data = string(ads_data.getitemdate(j,ls_
computer[l]))
ls_string = 'C;Y' + string(j + 1) + ';X' + string(i - n) + ';K"'+ ls_data + '"'
FileWrite(li_file,ls_string)
case 'decimal','int','long','number','real','ulong'
ls_data = string(ads_data.getitemnumber(j,ls_computer[l]))
ls_string = 'C;Y' + string(j + 1) + ';X' + string(i - n) + ';K"'+ ls_data + '"'
FileWrite(li_file,ls_string)
end choose
next
c++
else
n++
end if
else
ls_colname = ads_data.describe('#' + string(i - c) + '.name')
ls_text = ads_data.describe(ls_colname + '_t.text')
if ls_text <> '!' then
ls_string = 'C;Y1;X' + string(i - n) + ';K"' + ls_text + '"'
FileWrite(li_file,ls_string)
ls_type = lower(ads_data.describe(ls_colname + '.edit.style'))
for j = 1 to ll_rows
if ls_type = "edit" then
ls_data = string(ads_data.object.data[j,i -c])
else
ls_data = ads_data.Describe("evaluate('LookUpDisPlay("+ls_colname+")',"+string(j)+")")
end if
ls_string = 'C;Y' + string(j + 1) + ';X' + string(i - n) + ';K"'+ ls_data +'"'
FileWrite(li_file,ls_string)
next
else //埃⊿Τ陪ボ
n++
end if
end if
next
ls_string = 'E '
FileWrite(li_file,ls_string)
FileClose(li_file)
else
messagebox('矗ボ','ゴ秨ゅンア毖')
return - 1
end if
else
return - 1
end if
end if
return 0
else
messagebox('矗ボ','礚纗癸禜')
return - 1
end if

相关文档
相关文档 最新文档