2011-03-24 41 views
0

我正在努力尝试,我不能。我需要阅读/显示HTML中的特定单元格,就像其他文本一样。我使用的是这样的:阅读Excell数据(单元格)

function readData() 
{ 
    var excel=new ActiveXObject("Excel.Application"); 
    var book=excel.Workbooks.open("http://142.116.39.71/Produ.xls"); 
    var sheet=book.Worksheets.Item(1); 
    /*var data=sheet.Cells(x,y).Value; 
    var data=book.ActiveSheet.Cells(""); 
    return data();*/ 

excel.quit(); 
excel.application.quit(); 
excel = null; 
book = null; 
sheet = null; 
CollectGarbage(); 
} 

    value=readData("E,18"); 
    //var value=readData("E18", "E18"); 

    document.write("Value from Excel file is "+value); 

但.....我有这样的:Value from Excel file is undefined

回答

1

你的函数没有返回任何值。取消注释代码并更正代码是return data;而不是return data();

0

和你不通过参数传递给函数READDATA(X,Y)和你不声明变量“值” var value = readData("E","18");

多个语法错误

+0

pisd 2011-03-24 23:55:11