环境:SQL Server 2005 Analysis Services + OWC 1.1 +Win 7
准备:
1、在SQL Server 2005 Analysis Services建好olap数据库。
2、OWC连接SQL Server 2005 Analysis Services 有两种方式:A、直接连Analysis Services数据库;B、通过IIS的http端口访问。如果用二种,需要设置IIS(具体设置请用“SQL Server 2005 Analysis Services OWC http访问”进行百度查找)
一、html页面的代码
<html>
<head>
<title>OWC控件使用</title>
</head>
<body>
<object classid="CLSID:0002E55A-0000-0000-C000-000000000046" id="pivotTable1" width="100%" height="300px">
<!-- <param name="HTMLURL" value="">
<!-- <param name="HTMLData" value="">
<!-- <param name="DataType" value="XMLData">
<param name="AutoFit" value="1">
<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:80">
<param name="DisplayPropertyToolbox" value="true">-->
<param name="DisplayTitle" value="0">
<param name="DisplayToolbar" value="0">
<param name="DisplayFieldList" value="true">
<param name="Height" value="1000">
<param name="AutoFit" value="false">
<param name="DisplayOfficeLogo" value="false">
<param name="Title.Caption" value="false">
<param name="Title" value="false">
<param name="Caption" value="false">
<param name="connectionString" value="Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAnalysis;Data Source=127.0.0.1">
<param name="DataMember" value="登陆情况">
<!--
<param name="connectionString" value="Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAnalysis;Data Source=http://127.0.0.1/olap/msmdpump.dll">
<param name="DataMember" value="登陆情况">
-->
<p>如果您无法使用此控件,请点击<a href="owc11.exe">此处</a>进行下载安装。</p>
</object>
<object classid="CLSID:{0002E55D-0000-0000-C000-000000000046}" id="chart1" width="100%" height="300px">
<!-- <param name="HTMLURL" value="">
<!-- <param name="HTMLData" value="">
<!-- <param name="DataType" value="XMLData">
<param name="AutoFit" value="0">
<param name="DisplayColHeaders" value="0">
<param name="DisplayGridlines" value="0">
<param name="DisplayHorizontalScrollBar" value="0">
<param name="DisplayRowHeaders" value="0">
<param name="DisplayTitleBar" value="0">
<param name="DisplayToolbar" value="0">
<param name="DisplayVerticalScrollBar" value="0">
<param name="EnableAutoCalculate" value="0">
<param name="EnableEvents" value="-1">
<param name="MoveAfterReturn" value="-1">
<param name="MoveAfterReturnDirection" value="1">
<param name="RightToLeft" value="0">
<param name="ViewableRange" value="1:80">
<param name="DisplayPropertyToolbox" value="true">
<param name="DisplayTitle" value="0">
<param name="DisplayToolbar" value="1">
<param name="DisplayFieldList" value="true">
<param name="Height" value="1000">
<param name="AutoFit" value="false">
<param name="DisplayOfficeLogo" value="false">
<param name="Title.Caption" value="true">
<param name="Title" value="true">
<param name="Caption" value="true">
-->
<!--
<param name="connectionString" value="Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAnalysis;Data Source=127.0.0.1">
<param name="DataMember" value="登陆情况">
<param name="Type" value="50">
<param name="DataSource" value="pivotTable1">
<param name="connectionString" value="Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAnalysis;Data Source=127.0.0.1">
<param name="type" value="50">
<param name="DataMember" value="登陆情况">
-->
<param name="connectionString" value="Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAnalysis;Data Source=http://127.0.0.1/olap/msmdpump.dll">
<param name="DataMember" value="登陆情况">
<param name="type" value="50">
<param name="hasvalue" value="1">
<p>如果您无法使用此控件,请点击<a href="owc11.exe">此处</a>进行下载安装。</p>
</object>
<script>
chart1.DataSource=pivotTable1;
//chart1.type=60;
chart1.hasvalue=true;
//chart1.datalabelscollection.add().hasvalue=true;
//chart1.type=chart1.constants.chcharttypepie;
//chart1.type=chart1.constants.chcharttypecolumnclustered;
</script>
<!--
<object classid="CLSID:{0002E559-0000-0000-C000-000000000046}" id="SheetTable1" width="100%">
<param name="HTMLURL" value="">
<!-- <param name="HTMLData" value="">
<!-- <param name="DataType" value="XMLData">
<param name="AutoFit" value="1">
<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:80">
<param name="DisplayPropertyToolbox" value="true">
<param name="DisplayTitle" value="1">
<param name="DisplayToolbar" value="1">
<param name="DisplayFieldList" value="true">
<param name="Height" value="1000">
<param name="AutoFit" value="false">
<param name="DisplayOfficeLogo" value="false">
<param name="Title.Caption" value="true">
<param name="Title" value="true">
<param name="Caption" value="true">
<param name="connectionString" value="Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=UserAnalysis;Data Source=127.0.0.1">
<param name="DataMember" value="登陆情况">
<p>如果您无法使用此控件,请点击<a href="owc11.exe">此处</a>进行下载安装。</p>
</object>-->
</body>
</html>
二、界面截图