|
在watir + ruby +netbeans中
#Open Excel File
excel = WIN32OLE::new('excel.Application')
excel.DisplayAlerts = false
workbook = excel.Workbooks.Open(filename)
worksheet = workbook.WorkSheets(1)
worksheet.Select
line=1
data = []
while worksheet.Range("a#{line}").value
data << worksheet.Range("a#{line}:g#{line}").value #存到数组中
line = line + 1
end
workbook.close
excel.Quit #退出excel
return data
在excel中读取数据,但是excel中有一列是数字,读取出来是float型的,如何用上面这段代码获得 string型的,改为data << worksheet.Range("a#{line}:g#{line}").text也是行不通的.
请问各位大侠....... |
|