转载:

http://www.cnblogs.com/muer/p/yaxle.html

代码:

public ActionResult ImportData(HttpPostedFileBase file)
{
  Workbook workbook = new Workbook();
  Worksheet sheet = workbook.Worksheets[];   Cells cells = sheet.Cells;
  cells[, ].PutValue("Income");
  cells[, ].PutValue("Expense");
  cells[, ].PutValue("Company A");
  cells[, ].PutValue("Company B");
  cells[, ].PutValue("Company C");
  cells[, ].PutValue();
  cells[, ].PutValue();
  cells[, ].PutValue();
  cells[, ].PutValue();
  cells[, ].PutValue();
  cells[, ].PutValue();   int chartIndex = sheet.Charts.Add(ChartType.Column, , , , );   Aspose.Cells.Charts.Chart chart = sheet.Charts[chartIndex];   //第一条柱子
  chart.NSeries.Add("B2:B4", true);
  chart.NSeries.CategoryData = "A2:A4";
  Series aSeries1 = chart.NSeries[];
  aSeries1.Name = "=B1";
  chart.NSeries.IsColorVaried = true;
  //第二条柱子
  chart.NSeries.Add("C2:C4", true);
  chart.NSeries.CategoryData = "A2:A4";
  Series aSeries2 = chart.NSeries[];
  aSeries2.Name = "=C1";
  //修改柱子颜色
  aSeries2.Area.ForegroundColor = System.Drawing.Color.Green;   //修改柱形图背景色
  chart.PlotArea.Area.ForegroundColor = System.Drawing.Color.FromArgb(, , , );
  //修改区域背景色
  chart.ChartArea.Area.ForegroundColor = System.Drawing.Color.White;
  //显示数据表
  chart.ShowDataTable = true;
  //显示分类条
  chart.ShowLegend = true;
  chart.Title.Text = "Income Analysis";
  workbook.Save(path);
  return null;
}

C#------Aspose.cells使用方法的更多相关文章

  1. Aspose.Cells设置自动列宽(最佳列宽)及一些方法总结

    /// <summary> /// 设置表页的列宽度自适应 /// </summary> /// <param name="sheet">wor ...

  2. C# 读写Excel的一些方法,Aspose.Cells.dll

    需求:现有2个Excel,一个7000,一个20W,7000在20W是完全存在的.现要分离20W的,拆分成19W3和7000. 条件:两个Excel都有“登录名”,然后用“登录名”去关联2个Excel ...

  3. 使用Aspose.Cells生成Excel的方法详解(转)

    using System; using System.Collections.Generic;  using System.Linq;  using System.Web;  using System ...

  4. Aspose.Cells基础使用方法整理

    Aspose.Cells 插件,将web端数据以excel形式导出到客户端. 相关文档: https://blog.csdn.net/djk8888/article/details/53065416 ...

  5. C# WinForm 导出导入Excel/Doc 完整实例教程[使用Aspose.Cells.dll]

    [csharp] view plain copy 1.添加引用: Aspose.Cells.dll(我们就叫工具包吧,可以从网上下载.关于它的操作我在“Aspose.Cells操作说明 中文版 下载 ...

  6. NPOI、MyXls、Aspose.Cells 导入导出Excel(转)

    Excel导入及导出问题产生: 从接触.net到现在一直在维护一个DataTable导s出到Excel的类,时不时还会维护一个导入类.以下是时不时就会出现的问题: 导出问题: 如果是asp.net,你 ...

  7. 使用Aspose.Cells 根据模板生成excel里面的 line chart

    目的: 1.根据模板里面的excel数据信息,动态创建line chart 2.linechart 的样式改为灰色 3.以流的形式写到客户端,不管客户端是否装excel,都可以导出到到客户端 4.使用 ...

  8. 使用Aspose.Cells组件生成Excel文件

    生成带表头的Excel文件,格式如下显示. 当然更复杂的一些也可以通过 合并单元格的方法 public void Merge(int firstRow, int firstColumn, int to ...

  9. C# WinForm使用Aspose.Cells.dll 导出导入Excel/Doc 完整实例教程

    1.添加引用: Aspose.Cells.dll(我们就叫工具包吧,可以从网上下载.关于它的操作我在“Aspose.Cells操作说明 中文版 下载 Aspose C# 导出Excel 实例”一文中的 ...

随机推荐

  1. android 中解析json格式数据

    本文来自http://tonysun3544.iteye.com/category/188238 package com.tony.json; import android.app.Activity; ...

  2. 红楼梦人物关系图,一代大师成绝响,下回分解待何人,kindle读书摘要

      人物关系图: https://www.cnblogs.com/images/cnblogs_com/elesos/1120632/o_2033091006.jpg 红楼梦 (古典名著普及文库) ( ...

  3. $(window).height() 和 $(document).height()的区别

    $(window).height() 和 $(document).height()的区别 $(window).height()代表了当前可见区域的大小,$(document).height()则代表了 ...

  4. Process.StandardOutput

    Namespace:  System.DiagnosticsAssembly:  System (in System.dll) Syntax   C# C++ F# VB   [BrowsableAt ...

  5. 【转】【WPF】WPF MVVM 简单实例

    1 新建WPF 应用程序WPFMVVMExample 程序结构如下图所示. 2 Model实现 在Model文件夹下新建业务类StudentModel(类文件StudentModel.cs),类的详细 ...

  6. 【转】【Python】 python中的编码问题报错 'ascii' codec can't decode 及 URL地址获取中文

    1.unicode.gbk.gb2312.utf-8的关系 http://www.pythonclub.org/python-basic/encode-detail 这篇文章写的比较好,utf-8是u ...

  7. http 状态码 40x

    400 无法解析此请求. 401.1 未经授权:访问由于凭据无效被拒绝. 401.2 未经授权: 访问由于服务器配置倾向使用替代身份验证方法而被拒绝. 401.3 未经授权:访问由于 ACL 对所请求 ...

  8. doctest初次体验

    测试代码放在两个地方才有效果,一个是模块开头,一个是函数声明语句的下一行 doctest 的概念模型 在python的官方文档中,对doctest是这样介绍的: doctest模块会搜索那些看起来像是 ...

  9. 嵌入式开发之hisilicon---hi3536 处理器简介

    (1)处理器概述 (2)处理器模块架构 --------------author:pkf -------------------time:7-19 -------------------------- ...

  10. systemd的运行级别与服务管理命令简介

    从很久很久以前我们就在使用静态运行级别.而systemd提供了更为动态灵活的机制,来管控你的系统. 在开始介绍systemd命令前,让我们先简单的回顾一下历史.在Linux世界里,有一个很奇怪的现象, ...