PB中怎样把数据写到已经固定格式的EXCEL表中

来源:互联网 发布:mac格式化移动硬盘 编辑:程序博客网 时间:2024/06/06 01:03

int i,handle,n
handle = openchannel("Excel",'book1.xls')
if handle < 0 then
messagebox('提示','请打开EXCLE程序! 并打开BOOK1.XLS,且清空该表格!')
return
end if
setremote('r1c1' , '客户欠费分析表'     , handle)
setremote('r2c5' , '统计日期: ' + is_rq1 + ' 至 ' + is_rq2    , handle)
setremote('r3c1' , '排名' , handle)
setremote('r3c2' , '客户码' , handle)
setremote('r3c3' , '客户名称' , handle)
setremote('r3c4' , '应收总额' , handle)
setremote('r3c5' , '欠费总额' , handle)
setremote('r3c6' , '比率' , handle)
setremote('r3c7' , tab_1.tabpage_1.dw_1.object.no1_t.text , handle)
setremote('r3c8' , tab_1.tabpage_1.dw_1.object.no2_t.text , handle)
setremote('r3c9' , tab_1.tabpage_1.dw_1.object.no3_t.text , handle)
setremote('r3c10', tab_1.tabpage_1.dw_1.object.no4_t.text , handle)
setremote('r3c11', tab_1.tabpage_1.dw_1.object.no5_t.text , handle)
for i = 1 to tab_1.tabpage_1.dw_1.rowcount()
setremote("r" + string(i+3) + 'c1' , string(i) , handle)
setremote("r" + string(i+3) + 'c2' ,    tab_1.tabpage_1.dw_1.getitemstring (i , 'khbm') , handle)
setremote("r" + string(i+3) + 'c3' ,    tab_1.tabpage_1.dw_1.getitemstring (i , 'khmc') , handle)
setremote("r" + string(i+3) + 'c4' , string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'ys')) , handle)
setremote("r" + string(i+3) + 'c5' , string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'qf')) , handle)
setremote("r" + string(i+3) + 'c6' , string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'bl')) , handle)
setremote("r" + string(i+3) + 'c7' , string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'no1')) , handle)
setremote("r" + string(i+3) + 'c8' , string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'no2')), handle)
setremote("r" + string(i+3) + 'c9' , string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'no3')) , handle)
setremote("r" + string(i+3) + 'c10', string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'no4')) , handle)
setremote("r" + string(i+3) + 'c11', string(tab_1.tabpage_1.dw_1.getitemdecimal(i , 'no5')) , handle)
next
closechannel(handle)
messagebox('提示','保存完毕!')

 

转自:http://blog.csdn.net/bjash/archive/2007/07/08/1682580.aspx