<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>関数 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>try{ <br>for(var i=2;iif(oSheet.Cells(i,2).value =="null" || oSheet.Cells(i, 3).value =="null" ) <br>ブレーク; <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>CollectGarbage(); <br>} <br></script> <br> <br><input type="file" id="upfile" /><input type="button" onclick="readThis();" value="读取"> <br><br> <br><textarea id="txtArea"cols=50 rows=10></textarea> <br></html> <br> </div> <br> 以上の代金は、IE 安全レベルを設定する必要があり、正常に実行できません。