首页 新闻 会员 周边 捐助

Automation服务器不能创建对象

0
悬赏园豆:20 [已解决问题] 解决于 2007-12-19 09:55
<P>&lt;SCRIPT LANGUAGE="JavaScript"&gt;<BR>&nbsp;&nbsp;&nbsp; function AutomateExcel() <BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; // Start Excel and get Application object.<BR>&nbsp;&nbsp;&nbsp; var oXL = new ActiveXObject("Excel.Application"); <BR>&nbsp;&nbsp;&nbsp; // Get a new workbook.<BR>&nbsp;&nbsp;&nbsp; var oWB = oXL.Workbooks.Add();<BR>&nbsp;&nbsp;&nbsp; var oSheet = oWB.ActiveSheet;<BR>&nbsp;&nbsp;&nbsp; var table = document.all.data; <BR>&nbsp;&nbsp;&nbsp; var hang = table.rows.length;</P> <P>&nbsp;&nbsp;&nbsp; var lie = table.rows(0).cells.length; </P> <P>&nbsp;&nbsp;&nbsp; // Add table headers going cell by cell.<BR>&nbsp;&nbsp;&nbsp; for (i=0;i&lt;hang;i++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; for (j=0;j&lt;lie;j++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;<BR>&nbsp;&nbsp;&nbsp; }</P> <P>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; oXL.Visible = true;<BR>&nbsp;&nbsp;&nbsp; oXL.UserControl = true;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; &lt;/SCRIPT&gt;</P> <P>这段代码在html页面里面可以正常运行,到.net里面用localhost直接访问时会出现</P> <P>Automation服务器不能创建对象.用IP地址访问就不会出错.这是为什么,请大家指教!谢谢</P>
问题补充: regsvr32 scrrun.dll 安全模式设置成“中” regsvr32 msxml3.dll 都已经改了,可还是不行
叶子绿了的主页 叶子绿了 | 初学一级 | 园豆:50
提问于:2007-12-18 09:54
< >
分享
最佳答案
0
用localhost访问算本地访问,如果用IP的话即使是在本机访问也视为网络访问,在本地运行时可能权限受到限制,建议你看看IE的安全设置
niugm | 小虾三级 |园豆:1685 | 2007-12-18 11:22
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册