文档详情

owc控件分析和总结.docx

发布:2024-06-26约3.42千字共4页下载文档
文本预览下载声明

owc控件是microsoftoffice图表控件(owc10为ofiiceXP的组件、owc11为office2003的组件,组件的路径为C:\ProgramFiles\CommonFiles\MicrosoftShared\WebComponents\11\owc11,帮助文件的路径为C:\ProgramFiles\CommonFiles\MicrosoftShared\WebComponents\11\2052),它可以生成三维图、柱状图、饼状图、趋势图和误差图,下面以生成三维图web应用程序为例:

1,添加引用:在“com选项卡”中选择“misrosoftoffice11.0objectlibrary”

2,具体代码如下:

1usingSystem;2

3usingSystem.Collections;4

5usingSystem.ComponentModel;6

7usingSystem.Data;8

9usingSystem.Drawing;10

11usingSystem.Web;12

13usingSystem.Web.UI;14

15usingMicrosoft.Office.Interop;16

17

18namespaceWebApplication219{

///summary

///WebForm1的摘要说明。

////summary

publicclassWebForm1:System.Web.UI.Page24 {

25

26 privatevoidPage_Load(objectsender,System.EventArgse)27 {

28 stringstrCategory=1+\t+2+\t+3+\t+4+\t+5+\t+6+\t;

29 stringstrValue=9+\t+8+\t+4+\t+10+\t+12+\t+6+\t;

30

//声明对象

Microsoft.Office.Interop.Owc11.ChartSpaceThisChart=new Microsoft.Office.Interop.Owc11.ChartSpaceClass();

Microsoft.Office.Interop.Owc11.ChChartThisChChart =ThisChart.Charts.Add(0);

Microsoft.Office.Interop.Owc11.ChSeriesThisChSeries=ThisChChart.SeriesCollection.Add(0);

35

//显示图例

ThisChChart.HasLegend=true;

//标题

ThisChChart.HasTitle=true;

ThisChChart.Title.Caption=统计图;41

//给定x,y轴图示说明

ThisChChart.Axes[0].HasTitle=true;

ThisChChart.Axes[1].HasTitle=true;

ThisChChart.Axes[0].Title.Caption=月份;

ThisChChart.Axes[1].Title.Caption=数量;47

//图表类型

ThisChChart.Type=Microsoft.Office.Interop.Owc11.ChartChartTypeEnum.chChartTypeColumnClustered3D;

//旋转

ThisChChart.Rotation =360;

ThisChChart.Inclination=10;

//背景颜色

ThisChChart.PlotArea.Interior.Color=red;

//底色

ThisChChart.PlotArea.Floor.Interior.Color=green;57

58 ThisChChart.Overlap=50;59

////给定series的名字

ThisChSeries.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimSeriesNames,Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCod

显示全部
相似文档