一:創建模板

二:圖表Docment構建
public Document chart()
{
var doc = new Document();
var builder = new DocumentBuilder(doc);
var shape = builder.InsertChart(Aspose.Words.Drawing.Charts.ChartType.Column, 432, 252);
var chart = shape.Chart;
var seriescoll = chart.Series;
seriescoll.Clear();
//Create category names array, in this example we have two categories.
//創建類別名稱數組,在此示例中我們有兩個類別。
string[] categories = { "第一賽季", "第二賽季", "第三賽季" };
//添加新系列。數據數組不能為空,並且數組的大小必須相同。
seriescoll.Add("AW Series 1", categories, new double[] { 1, 2, 2 });
seriescoll.Add("AW Series 2", categories, new double[] { 3, 4, 44 });
seriescoll.Add("AW Series 3", categories, new double[] { 5, 6, 22 });
seriescoll.Add("AW Series 4", categories, new double[] { 7, 81, 3 });
seriescoll.Add("AW Series 5", categories, new double[] { 9, 10, 44 });
return doc;
}
三:使用
Document doc = new Document(Server.MapPath(path)); builder.InsertDocument(chart(),ImportFormatMode.UseDestinationStyles); doc.Save(System.Web.HttpContext.Current.Response, "C00.doc", ContentDisposition.Attachment, null);
效果:

