如题,将数据存放到excel中,我已经实现了,但是如何在 excel中通过保存的数据,指定相关数据列并且 对应的生成统计图呢?
主要用excel.dll中的那些方法啊?

解决方案 »

  1.   

    http://xhp5678.cnblogs.com/archive/2005/08/13/214126.html
    这个也许对你有帮助^_^
      

  2.   

    兄弟,微软的Office提供了一个叫宏的工具,这么好的东西你要会用呀,别糟蹋了
      

  3.   

    谁说宏没有代码????????只不过是vba的而已
      

  4.   

    http://community.csdn.net/Expert/topic/4252/4252815.xml?temp=.2856562www.webmis.com.cn下载看那个打印程序的Excel模板打印。
      

  5.   

    在微软的MSDN中找到了答案,非常好,建议大家多多到MSDN中去转转,会有意想不到的收获啊!
    相关代码如下:Excel.Application thisWorkbook = new Excel.ApplicationClass();
    thisWorkbook.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
    for(int i=1;i<=10;i++)
    {
    thisWorkbook.Cells[1,i]="第"+i.ToString()+"列";
    }
    for(int i=2;i<=10;i++)
    {
    for(int j=1;j<=10;j++)
    {
    thisWorkbook.Cells[i,j]=i;
    }
    }
    thisWorkbook.Visible = true;
    Excel.Worksheet thisWorksheet;
    thisWorksheet = thisWorkbook.ActiveSheet as Excel.Worksheet;
    Excel.ChartObjects charts = 
    (Excel.ChartObjects)thisWorksheet.ChartObjects(Type.Missing); // Adds a chart at x = 100, y = 300, 500 points wide and 300 tall.
    Excel.ChartObject chartObj = charts.Add(100, 300, 500, 300);
    Excel.Chart chart = chartObj.Chart; // Gets the cells that define the bounds of the data to be charted.
    Excel.Range chartRange = thisWorksheet.get_Range("A1","B1");
    chart.SetSourceData(chartRange,Type.Missing); chart.ChartType = Excel.XlChartType.xlLineMarkersStacked100;
    Excel.SeriesCollection seriesCollection= 
    (Excel.SeriesCollection)chart.SeriesCollection(Type.Missing);
    Excel.Series series = seriesCollection.Item(seriesCollection.Count); thisWorkbook.Quit();
    thisWorkbook=null;
    GC.Collect();在此也非常感谢大家的帮助,节贴,给分!!!
    吼吼吼!!