C#------Aspose.cells使用方法
2017-08-06 21:09
429 查看
转载:
代码:
http://www.cnblogs.com/muer/p/yaxle.html
代码:
public ActionResult ImportData(HttpPostedFileBase file) { Workbook workbook = new Workbook(); Worksheet sheet = workbook.Worksheets[0]; Cells cells = sheet.Cells; cells[0, 1].PutValue("Income"); cells[0, 2].PutValue("Expense"); 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); cells[1, 2].PutValue(8000); cells[2, 2].PutValue(15000); cells[3, 2].PutValue(28000); int chartIndex = sheet.Charts.Add(ChartType.Column, 6, 6, 21, 15); Aspose.Cells.Charts.Chart chart = sheet.Charts[chartIndex]; //第一条柱子 chart.NSeries.Add("B2:B4", true); chart.NSeries.CategoryData = "A2:A4"; Series aSeries1 = chart.NSeries[0]; aSeries1.Name = "=B1"; chart.NSeries.IsColorVaried = true; //第二条柱子 chart.NSeries.Add("C2:C4", true); chart.NSeries.CategoryData = "A2:A4"; Series aSeries2 = chart.NSeries[1]; aSeries2.Name = "=C1"; //修改柱子颜色 aSeries2.Area.ForegroundColor = System.Drawing.Color.Green; //修改柱形图背景色 chart.PlotArea.Area.ForegroundColor = System.Drawing.Color.FromArgb(1, 152, 186, 180); //修改区域背景色 chart.ChartArea.Area.ForegroundColor = System.Drawing.Color.White; //显示数据表 chart.ShowDataTable = true; //显示分类条 chart.ShowLegend = true; chart.Title.Text = "Income Analysis"; workbook.Save(path); return null; }
相关文章推荐
- aspose.Cells使用方法
- 使用Aspose.Cells生成Excel的方法详解(转)
- Aspose.Cells使用方法总结大全
- Aspose.Cells基础使用方法整理
- Aspose.Cells基础使用方法整理
- Aspose.Cells基础使用方法整理
- 【转】Aspose.Cells基础使用方法整理
- Aspose.Cells使用方法大全(基本操作+转换+导出+水印添加+工作表合并)
- 使用Aspose.Cells生成Excel的方法详解(转)
- Aspose.Cells使用教程大全
- 使用Aspose.Cells 过程中用过的知识
- 使用Aspose.Cells的基础知识整理 .
- 使用Aspose.Cells实现简单的Excle导出
- Aspose.Pdf使用方法与技巧总结
- 使用Aspose.Cells的基础知识整理
- 使用Aspose.Cells为工作表添加艺术字水印
- 使用Aspose.Cells将工作表保存为不同的PDF文件
- [Asp.net]Aspose.Cells.Workbook.Save()方法不同版本下的区别
- Aspose.Cells 使用整理:读取Excel文件里的数据
- 使用Aspose.Cells的基础知识整理