??? /**
??? ?* 读取EXCEL
??? ?*/
??? function readExcel(filePath) {
??? ??? var tempStr = "";
??? ??? var oXL = new ActiveXObject("Excel.application");
??? ??? var oWB = oXL.Workbooks.open(filePath);
??? ??? oWB.worksheets(1).select();//选中第一个SHEET页
??? ??? var oSheet = oWB.ActiveSheet;
??? ??? try {
??? ??? ??? for (var i = 2; i < 20; i++) {
??? ??? ??? ??? tempStr += ("? " + oSheet.Cells(i, 1).value + "? "//循环读取数据,i为行1为列
??? ??? ??? ??? ??? ??? + oSheet.Cells(i, 2).value + "? "
??? ??? ??? ??? ??? ??? + oSheet.Cells(i, 3).value + "? "
??? ??? ??? ??? ??? ??? + "\n");
??? ??? ??? }
??? ??? } catch (e) {
??? ??? ??? alert(tempStr);
??? ??? }
??? ??? alert(tempStr);
??? ??? oXL.Quit();
??? ??? CollectGarbage();
??? }
?
注意客户端必须用 IE ,并且 IE选项中,安全标签页,Internet区域安全自定义,将"对未标记为可安全执行脚本的ACTIVEX控件初始化并执行脚本" 进行启用即可正常使用。