悬赏园豆:20
[已解决问题]
解决于 2007-12-19 09:55
<P><SCRIPT LANGUAGE="JavaScript"><BR> function AutomateExcel() <BR> {<BR> // Start Excel and get Application object.<BR> var oXL = new ActiveXObject("Excel.Application"); <BR> // Get a new workbook.<BR> var oWB = oXL.Workbooks.Add();<BR> var oSheet = oWB.ActiveSheet;<BR> var table = document.all.data; <BR> var hang = table.rows.length;</P>
<P> var lie = table.rows(0).cells.length; </P>
<P> // Add table headers going cell by cell.<BR> for (i=0;i<hang;i++)<BR> {<BR> for (j=0;j<lie;j++)<BR> {<BR> oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;<BR> }</P>
<P> }<BR> oXL.Visible = true;<BR> oXL.UserControl = true;<BR> }<BR> </SCRIPT></P>
<P>这段代码在html页面里面可以正常运行,到.net里面用localhost直接访问时会出现</P>
<P>Automation服务器不能创建对象.用IP地址访问就不会出错.这是为什么,请大家指教!谢谢</P>
问题补充:
regsvr32 scrrun.dll
安全模式设置成“中”
regsvr32 msxml3.dll
都已经改了,可还是不行
叶子绿了
|
初学一级
|
园豆:
50
提问于:2007-12-18 09:54