###########################################################
# 函数名:readconfig
# 输入参数:无
# 返回参数:返回一个列表。
###########################################################
proc readconfig {} {
package require tcom
#创建com实例
set excel [::tcom::ref createobj Excel.Application]
$excel Visible 1
set workbooks [$excel Workbooks]
#打开指定目录的工作表
set workbook [$workbooks Open {D:\TS\C8500\C85_oltconfig.xls}]
set worksheets [$workbook Worksheets]
set worksheet [$worksheets Item [expr 1]]
set cells [$worksheet Cells]
#取配置文件的2~16行数据。
for {set i 2} {$i <= 55 } {incr i} {
#puts $i
set id [expr $i]
#puts $id
#取第二列中的数据
set cell [$cells Item $id 2]
if {[$cell Value] > 0 } {
#放入到列表中去
#puts [$cell Value]
lappend ex_list [$cell Value]
}
}
#退出excel
$excel Quit
return $ex_list
}
# 函数名:readconfig
# 输入参数:无
# 返回参数:返回一个列表。
###########################################################
proc readconfig {} {
package require tcom
#创建com实例
set excel [::tcom::ref createobj Excel.Application]
$excel Visible 1
set workbooks [$excel Workbooks]
#打开指定目录的工作表
set workbook [$workbooks Open {D:\TS\C8500\C85_oltconfig.xls}]
set worksheets [$workbook Worksheets]
set worksheet [$worksheets Item [expr 1]]
set cells [$worksheet Cells]
#取配置文件的2~16行数据。
for {set i 2} {$i <= 55 } {incr i} {
#puts $i
set id [expr $i]
#puts $id
#取第二列中的数据
set cell [$cells Item $id 2]
if {[$cell Value] > 0 } {
#放入到列表中去
#puts [$cell Value]
lappend ex_list [$cell Value]
}
}
#退出excel
$excel Quit
return $ex_list
}