盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

asp.net中调用Office来制作3D统计图

时间:2024/11/11作者:未知来源:盾怪网教程人气:

[摘要]1、首先下载owc11 COM组件 [点击下载]   2、注册owc11  在工程中添加 C:\Program Files\Common Files\Microsoft Shared\...

   1、首先下载owc11 COM组件

       [点击下载]

  2、注册owc11

  在工程中添加 C:\Program Files\Common Files\Microsoft Shared\Web Components\11  文件下的owc11.dll引用

  3、在工程中添加

  using OWC11;

  4、开始coding  举例如下:


   public class ChartFactory
  {
  public ChartFactory()
  {
  InitTypeMap();
  //
  // TODO: 在此处添加构造函数逻辑
  //
  }
  protected System.Web.UI.WebControls.Image imgHondaLineup;
  private string[] chartCategoriesArr;
  private string[] chartValuesArr;
  private OWC11.ChartChartTypeEnum chartType =  OWC11.ChartChartTypeEnum.chChartTypeColumn3D;//默认值
  private static Hashtable chartMap = new Hashtable();
  private static string chartTypeCh = "垂直柱状图" ;
  private static string chartTitle = "";

  private void InitTypeMap()
  {
  chartMap.Clear();
  OWC11.ChartChartTypeEnum[] chartTypes = new OWC11.ChartChartTypeEnum[]{ ChartChartTypeEnum.chChartTypeColumnClustered,
  ChartChartTypeEnum.chChartTypeColumn3D,
  ChartChartTypeEnum.chChartTypeBarClustered,
  ChartChartTypeEnum.chChartTypeBar3D,
  ChartChartTypeEnum.chChartTypeArea,
  ChartChartTypeEnum.chChartTypeArea3D,
  ChartChartTypeEnum.chChartTypeDoughnut,
  ChartChartTypeEnum.chChartTypeLineStacked,
  ChartChartTypeEnum.chChartTypeLine3D,
  ChartChartTypeEnum.chChartTypeLineMarkers,
  ChartChartTypeEnum.chChartTypePie,
  ChartChartTypeEnum.chChartTypePie3D,
 

   ChartChartTypeEnum.chChartTypeRadarSmoothLine,
  ChartChartTypeEnum.chChartTypeSmoothLine};

 

  string[] chartTypesCh = new string [] {"垂直柱状统计图","3D垂直柱状统计图","水平柱状统计图","3D水平柱状统计图","区域统计图","3D区域统计图","中空饼图","折线统计图","3D折线统计图","折线带点统计图","饼图","3D饼图","网状统计图","弧线统计图"};


   for(int i=0;i<chartTypes.Length;i++)
  {
  chartMap.Add(chartTypesCh[i],chartTypes[i]);
  }
  }
  public ChartSpaceClass BuildCharts ()
  {
  string chartCategoriesStr = String.Join ("\t", chartCategoriesArr);
  string chartValuesStr = String.Join ("\t", chartValuesArr);

  OWC11.ChartSpaceClass       oChartSpace = new OWC11.ChartSpaceClass ();

  // ------------------------------------------------------------------------
  // Give pie and doughnut charts a legend on the bottom. For the rest of
  // them let the control figure it out on its own.
  // ------------------------------------------------------------------------

  chartType = (ChartChartTypeEnum)chartMap[chartTypeCh];

  if (chartType == ChartChartTypeEnum.chChartTypePie

关键词:asp.net中调用Office来制作3D统计图




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版