if datawindow.Describe("DataWindow.Processing") > '1' then //1-----grid风格的数据窗口
return
end if
int li_ret
li_ret = ole_excel.ConnectToObject('Excel.Application')
if li_ret <> 0 then
li_ret = ole_excel.ConnectToNewObject('Excel.Application')
if li_ret <> 0 then
MessageBox('OLE错误','OLE无法连接,请返回重试!') //~r~n错误号:' + String(li_ret))
end if
ole_excel.Visible = false
end if
string ywry1,sffdw1,djhm1,lgrq1,chm1,hc1,tdh1,portd1,rpw1,compute1,compute2
string ls_model_path,ls_model_file,k
oleobject excelserver
integer count,ret,i,j,pd
long row=1
real sumje
ls_model_path = gs_model_path + '1.xls'
ls_model_file = '1.xls'
count=dw_1.rowcount()
ret = getfileopenName('',ls_model_path,ls_model_file,'xls','Excel 文档,*.xls')
if ret<>1 then
messagebox('警告','没有找到模板文件!')
return
end if
excelserver=create oleobject
ret=excelserver.connecttonewobject("excel.application")
if ret<0 then
messagebox('错误',"不能启动EXCEL!")
excelserver.disconnectobject()
destroy excelserver
return
end if
ExcelServer.Visible = TRUE
excelserver.application.workbooks.add(ls_model_path)
if isnull(excelserver) then
return
end if
string ls_ywry,ls_ywry_s,ls_dw,ls_dw_s
string ls_djhm,ls_lgrq,ls_chm,ls_hc,ls_tdh,ls_portd,ls_sf
long ll_add
decimal ldec_usb,ldec_rmb,ldec_usb_hj,ldec_rmb_hj,ldec_usb_hj1,ldec_rmb_hj1
decimal ldec_usb_hj2,ldec_rmb_hj2,ldec_usb_hj3,ldec_rmb_hj3
for i = 1 to count
ls_ywry = trim(dw_1.getitemstring(i,'ywry'))
ls_dw = trim(dw_1.getitemstring(i,'sffdw'))
ls_djhm = trim(dw_1.getitemstring(i,'djhm'))
ls_lgrq = trim(dw_1.getitemstring(i,'lgrq'))
ls_chm = trim(dw_1.getitemstring(i,'chm'))
ls_hc = trim(dw_1.getitemstring(i,'hc'))
ls_tdh = trim(dw_1.getitemstring(i,'tdh'))
ls_portd = trim(dw_1.getitemstring(i,'portd'))
ls_sf = trim(dw_1.getitemstring(i,'row_column'))
ldec_usb = dw_1.getitemnumber(i,'compute_0011_1')
if isnull(ldec_usb) then
ldec_usb = 0
end if
ldec_rmb = dw_1.getitemnumber(i,'compute_0011')
if isnull(ldec_rmb) then
ldec_rmb = 0
end if
if i <> 1 then
if ls_dw_s <> ls_dw then
ExcelServer.Application.ActiveSheet.Cells(i + ll_add + 1,2).value = ls_dw_s
ExcelServer.Application.ActiveSheet.Cells(i + ll_add + 1,9).value = ldec_rmb_hj1
ExcelServer.Application.ActiveSheet.Cells(i + ll_add + 1,10).value = ldec_usb_hj1
ldec_usb_hj1 = 0
ldec_rmb_hj1 = 0
ll_add = ll_add + 1
end if
if ls_ywry_s <> ls_ywry then
ExcelServer.Application.ActiveSheet.Cells(i + ll_add + 1,1).value = ls_ywry_s
ExcelServer.Application.ActiveSheet.Cells(i + ll_add + 1,9).value = ldec_rmb_hj2
ExcelServer.Application.ActiveSheet.Cells(i + ll_add + 1,10).value = ldec_usb_hj2
ldec_usb_hj2 = 0
ldec_rmb_hj2 = 0
ll_add = ll_add + 1
end if
end if