2011-03-24 60 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