在Web app中,若要使用ActiveX控件的话,不用自己createobject,(在项目引用中添加对此COM组件的引用,对控件不用这一步),然后在工具箱中加入该COM控件,再把该控件拖到WEB窗体上就行了,vs.net会帮你做好一切。如下面是在页面中拖入Excel表格控件后自动生成的页面代码:<%@ Page language="c#" Codebehind="ComTest.aspx.cs" AutoEventWireup="false" Inherits="WebApplication2.ComTest" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ComText</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="ComText" method="post" runat="server">
<OBJECT style="Z-INDEX: 101; LEFT: 74px; POSITION: absolute; TOP: 39px" classid="clsid:0002E510-0000-0000-C000-000000000046">
<PARAM NAME="HTMLURL" VALUE="">
<PARAM NAME="HTMLData" VALUE="<html xmlns:x=&quot;urn:schemas-microsoft-com:office:excel&quot;&#13;&#10;xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;>&#13;&#10;&#13;&#10;<head>&#13;&#10;<style type=&quot;text/css&quot;>&#13;&#10;<!--tr&#13;&#10;&#9;{mso-height-source:auto;}&#13;&#10;td&#13;&#10;&#9;{white-space:nowrap;}&#13;&#10;.wc819D1A81&#13;&#10;&#9;{white-space:nowrap;&#13;&#10;&#9;font-family:宋体;&#13;&#10;&#9;mso-number-format:General;&#13;&#10;&#9;font-size:auto;&#13;&#10;&#9;font-weight:auto;&#13;&#10;&#9;font-style:auto;&#13;&#10;&#9;text-decoration:auto;&#13;&#10;&#9;mso-background-source:auto;&#13;&#10;&#9;mso-pattern:auto;&#13;&#10;&#9;mso-color-source:auto;&#13;&#10;&#9;text-align:general;&#13;&#10;&#9;vertical-align:bottom;&#13;&#10;&#9;border-top:none;&#13;&#10;&#9;border-left:none;&#13;&#10;&#9;border-right:none;&#13;&#10;&#9;border-bottom:none;&#13;&#10;&#9;mso-protection:locked;}&#13;&#10;-->&#13;&#10;</style>&#13;&#10;</head>&#13;&#10;&#13;&#10;<body>&#13;&#10;<!--[if gte mso 9]><xml>&#13;&#10; <x:ExcelWorkbook>&#13;&#10;  <x:ExcelWorksheets>&#13;&#10;   <x:ExcelWorksheet>&#13;&#10;    <x:OWCVersion>9.0.0.3821</x:OWCVersion>&#13;&#10;    <x:Label Style='border-top:solid .5pt silver;border-left:solid .5pt silver;&#13;&#10;     border-right:solid .5pt silver;border-bottom:solid .5pt silver'>&#13;&#10;     <x:Caption>Microsoft Office Spreadsheet</x:Caption>&#13;&#10;    </x:Label>&#13;&#10;    <x:Name>Sheet1</x:Name>&#13;&#10;    <x:WorksheetOptions>&#13;&#10;     <x:Selected/>&#13;&#10;     <x:Height>7620</x:Height>&#13;&#10;     <x:Width>15240</x:Width>&#13;&#10;     <x:TopRowVisible>0</x:TopRowVisible>&#13;&#10;     <x:LeftColumnVisible>0</x:LeftColumnVisible>&#13;&#10;     <x:ProtectContents>False</x:ProtectContents>&#13;&#10;     <x:DefaultRowHeight>210</x:DefaultRowHeight>&#13;&#10;     <x:StandardWidth>2389</x:StandardWidth>&#13;&#10;    </x:WorksheetOptions>&#13;&#10;   </x:ExcelWorksheet>&#13;&#10;  </x:ExcelWorksheets>&#13;&#10;  <x:MaxHeight>80%</x:MaxHeight>&#13;&#10;  <x:MaxWidth>80%</x:MaxWidth>&#13;&#10; </x:ExcelWorkbook>&#13;&#10;</xml><![endif]-->&#13;&#10;&#13;&#10;<table class=wc819D1A81 x:str>&#13;&#10; <col class=wc819D1A81 width=&quot;56&quot;>&#13;&#10; <tr height=&quot;14&quot;>&#13;&#10;  <td class=wc819D1A81></td>&#13;&#10; </tr>&#13;&#10;</table>&#13;&#10;&#13;&#10;</body>&#13;&#10;&#13;&#10;</html>&#13;&#10;">
<PARAM NAME="DataType" VALUE="HTMLDATA">
<PARAM NAME="AutoFit" VALUE="0">
<PARAM NAME="DisplayColHeaders" VALUE="-1">
<PARAM NAME="DisplayGridlines" VALUE="-1">
<PARAM NAME="DisplayHorizontalScrollBar" VALUE="-1">
<PARAM NAME="DisplayRowHeaders" VALUE="-1">
<PARAM NAME="DisplayTitleBar" VALUE="-1">
<PARAM NAME="DisplayToolbar" VALUE="-1">
<PARAM NAME="DisplayVerticalScrollBar" VALUE="-1">
<PARAM NAME="EnableAutoCalculate" VALUE="-1">
<PARAM NAME="EnableEvents" VALUE="-1">
<PARAM NAME="MoveAfterReturn" VALUE="-1">
<PARAM NAME="MoveAfterReturnDirection" VALUE="0">
<PARAM NAME="RightToLeft" VALUE="0">
<PARAM NAME="ViewableRange" VALUE="1:65536">
</OBJECT>
</form>
</body>
</HTML>