怎样用c#操作excel里的chart对象
来源:互联网 发布:java 事务 编辑:程序博客网 时间:2024/06/13 20:31
public void CreateChart()
{
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("A5","D8");
chart.SetSourceData(chartRange,Type.Missing);
chart.ChartType = Excel.XlChartType.xlXYScatter;
Excel.SeriesCollection seriesCollection=
(Excel.SeriesCollection)chart.SeriesCollection(Type.Missing);
Excel.Series series = seriesCollection.Item(seriesCollection.Count);
}
Find something in google.
Excel excel = new Excel();
Worksheet sheet = excel.Worksheets[0];
Cells cells = sheet.Cells;
cells[0,1].PutValue("Income");
cells[1,0].PutValue("Company A");
cells[2,0].PutValue("Company B");
cells[3,0].PutValue("Company C");
cells[1,1].PutValue(10000);
cells[2,1].PutValue(20000);
cells[3,1].PutValue(30000);
int chartIndex = sheet.Charts.Add(ChartType.Column, 9, 9, 21, 15);
Chart chart = sheet.Charts[chartIndex];
chart.NSeries.Add("B2:B4", true);
chart.NSeries.CategoryData = "A2:A4";
ASeries aSeries = chart.NSeries[0];
aSeries.Name = "=B1";
chart.IsLegendShown = true;
chart.Title.Text = "Income Analysis";
设置excel自动筛选
Sample_sheet.get_Range("A4", Type.Missing).EntireRow.AutoFilter(1,Type.Missing,Excel.XlAutoFilterOperator.xlAnd,Type.Missing,true);
- 怎样用c#操作excel里的chart对象
- Python怎样用C实现对象的多态性
- c# 操作excel chart
- 怎样用C++Builder存取Excel
- Excel Chart的命名
- Excel中Chart对象成员表
- 用C#操作Excel以及产生Chart
- 怎样用SQL Server 2008 SQL语句将Excel数据导入到数据库里指定的表里面?(
- 怎样用SQL Server 2008 SQL语句将Excel数据导入到数据库里指定的表里面
- C#操作EXCEl的chart折线图 封转的类
- C#操作EXCEl的chart折线图 封转的类
- [C#]对Excel的操作
- Chart里的一些属性说明
- 如何操作水晶报表里的对象
- pb里的BLOB对象操作
- action里对域对象的操作.
- 怎样用编程的方法操作杀毒软件
- 怎样用编程的方法操作杀毒软件
- 中国dos 联盟-dos启动盘
- 手机WIFI连接电脑
- AspNetPager分页控件的使用
- [ASP中使用三层架构] 9.用户登录之一 User表与相关类
- URL
- 怎样用c#操作excel里的chart对象
- 文件夹的属性里显示安全选项
- 记事本,word(doc),pdf,右键菜单打开慢的问题的完整解答
- sql日期格式化
- JAVA高级程序员面试三十二问
- Ubuntu的root密码问题
- 关于研究所的一些思考
- oracle -----快速删除重复的记录
- silverlight运行时出错:无法下载silverlight应用程序