共享社区

首页 » 互联网资源共享社区 » 商业智能共享 » 使用XtraPivotGrid 展示数据透视表
cube - 2008-4-18 8:44:00
使用这片文章中的代码首先要安装Developer Express .NET v7.1
下载地址:http://www.devexpress.com/Downloads/
网上也有很多破解版本下载,用以提供给那些学习的朋友使用。

XtraPivotGrid这个控件是类似于微软OWC11中的PivotTable透视表控件
,它非常方便的支持展示OLAP服务器的多维数据集。
安装好Developer Express .NET v7.1以后,就会发现我们的vs2005的
toolbox上面多了很多控件。



然后我们把PivotGridControl拖动到我们的

form窗体上去。然后编写form的load事件,绑定控件的数据源,代码如
下:
this.pivotGridControl1.OLAPConnectionString =
"Provider=msolap;Data Source=localhost;Initial
Catalog=Adventure Works DW Standard Edition;Cube Name=Adventure
Works;";
           
            PivotGridField fieldMeasuresInternetSalesAmount =

new PivotGridField("[Measures].[Internet Sales Amount]",
PivotArea.DataArea);
            fieldMeasuresInternetSalesAmount.Caption =

"Internet Sales Amount";
            PivotGridField fieldCustomerCountryCountry = new

PivotGridField("[Customer].[Country].[Country]",
PivotArea.RowArea);
            fieldCustomerCountryCountry.Caption = "Country";
            PivotGridField fieldDateFiscalYearFiscalYear = new

PivotGridField("[Date].[Fiscal Year].[Fiscal Year]",
PivotArea.ColumnArea);
            fieldDateFiscalYearFiscalYear.Caption = "Fiscal

Year";
         
            this.pivotGridControl1.Fields.AddRange(new

PivotGridField[] { fieldMeasuresInternetSalesAmount,
fieldCustomerCountryCountry, fieldDateFiscalYearFiscalYear });

运行结果:

好了,打完收工,类似于OWC11中的PivotTable的功能完成了。有的朋友

要问了,为什么直接用OWC呢?因为我不会用,呵呵,从来没有用OWC做
过东西,相反,xtra这套控件我是相当熟悉,因为我们公司就用这套软
件来开发ERP的。


原文出处:http://www.cnblogs.com/lijun4017/
1
查看完整版本: 使用XtraPivotGrid 展示数据透视表