<div class="codetitle"> <span><a style="CURSOR: pointer" data="88717" class="copybut" id="copybut88717" onclick="doCopy('code88717')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code88717"> <br><script> <br>function readThis(){ <br>var tempStr = ""; <br>var filePath= document.all.upfile.value; <br>var oXL = new ActiveXObject("Excel.application"); <br>var oWB = oXL.Workbooks.open(filePath); <br>oWB.worksheets(1).select(); <br>var oSheet = oWB.ActiveSheet; <br>시도해 보세요{ <br>for(var i=2;iif(oSheet.Cells(i,2).value =="null" || oSheet.Cells(i, 3).value =="null" ) <br>break; <br>var a = oSheet.Cells(i,2).value.toString()=="정의되지 않음"?"":oSheet.Cells(i,2).value; <br>tempStr =(" " oSheet.Cells(i,2).value <br>" " oSheet.Cells(i,3).value <br>" " oSheet.Cells(i,4).value <br>" " oSheet.Cells(i,5).value <br>" " oSheet.Cells(i,6).value "n"); <br>} <br>}catch(e){ <br>//alert(e); <br>document.all.txtArea.value = tempStr; <br>} <br>document.all.txtArea.value = tempStr; <br>oXL.Quit(); <br>쓰레기 수집(); <br>} <br></script> <br><html> <br><input type="file" id="upfile" /><input type="button" onclick="readThis();" value="读取"> <br><br> <br><textarea id="txtArea" cols=50 행=10></textarea> <br></html> <br> </div> <br>以上代码에서 需要设置IE 보안을 유지하고 있습니다.