谢谢这么多朋友关心,为了大家共同研究,现贴出主要代码: WebSpread2.ASP <html> <Title>Excel Spreadsheet Component</Title> <body> <div style="text-align:left;background:buttonface;border-bottom:inset 1px white;border-right:outset 1px white;"> <b>目录:</b><input type="text" name="danwei" size="20"> <b>表名:</b><input type="text" name="excelid" size="20"> <input type="button" value="查询" OnClick="findzc()"> <input type="button" value="更新" OnClick="addsave()"> <input type="button" value="填表" OnClick="exce_OnClick()"> </div> <object classid="clsid:0002E551-0000-0000-C000-000000000046" id="Spread1" style="width:100%;height:95%;"> </object> </body> </html> <SCRIPT LANGUAGE="VBScript"> Sub exceon_OnClick() Spread1.worksheets("Sheet1").Range("a1:h10").value = 22223 End Sub </SCRIPT> <script language="javascript"> function exce_OnClick(){ Spread1.ActiveSheet.Cells.Clear(); Spread1.Worksheets("Sheet1").Cells(10,10).value = "22ffff23";
} function findzc() { Spread1.ActiveSheet.Cells.Clear(); var oBao = new ActiveXObject("Microsoft.XMLHTTP"); var userInfo1= "dwbm=" + document.all.danwei.value+"|"+document.all.excelid.value; oBao.open("POST","server4.asp",false); oBao.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); oBao.send(userInfo1); var strResult = unescape(oBao.responseText); var arrResult = strResult.split("###"); iii=arrResult.length for( i=0;i<iii;i++) { arrTmp = arrResult.split("@@@"); for( x=0;x<=arrTmp.length;x++) { var num1 = arrTmp[0]; var num2 = arrTmp[1]; var num3 = arrTmp[2]; Spread1.worksheets("Sheet1").cells(i+1,x+1).value=arrTmp[x];
} } } </script> |