资源简介

Aspose.Words根据word模板标签进行替换,并插入图表(chart)饼形图,柱形图

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Aspose.Words;
using Aspose.Words.Fields;
using Aspose.Words.Drawing;
using Aspose.Words.Drawing.Charts;
using Aspose.Words.Saving;
using System.IO;

namespace WebApplication3
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender EventArgs e)
        {

        }

        protected void Button1_Click(object sender EventArgs e)
        {
            string tmppath = this.Page.Server.MapPath(“test.docx“);
            Aspose.Words.Document doc = new Aspose.Words.Document(tmppath);

            BindFiledValue(ref doc “title“ “测试标题“);
            BindFiledValue(ref doc “dy“ “测试第一内容“);
                        
            DocumentBuilder builder = new DocumentBuilder(doc);// 
            //builder.InsertParagraph();
            builder.MoveToBookmark(“image“);
            Shape shape = builder.InsertChart(ChartType.Column3DClustered 432 252);
            Chart chart = shape.Chart;
            ChartSeriesCollection seriesColl = chart.Series;
            seriesColl.Clear();
            string[] categories = new string[] { “AW Category 1“ “AW Category 2“ };

            seriesColl.Add(“AW Series 1“ categories new double[] { 1 2 });
            seriesColl.Add(“AW Series 2“ categories new double[] { 3 4 });
            seriesColl.Add(“AW Series 3“ categories new double[] { 5 6 });
            seriesColl.Add(“AW Series 4“ categories new double[] { 7 8 });
            seriesColl.Add(“AW Series 5“ categories new double[] { 9 10 });

            //
            Shape shape1 = builder.InsertChart(ChartType.Pie3D 432 252);
            Chart chart1 = shape1.Chart;
            ChartSeriesCollection seriesColl1 = chart1.Series;
            seriesColl1.Clear();
            string[] categories1 = new string[] { “AW Category 1““12““234“};

            seriesColl1.Add(“AW Series 1“ categories1 new double[] { 1 4 8 });

            //seriesColl.Add(“AW Series 2“ categories new double[] { 3 });
            //seriesColl.Add(“AW Series 3“ categories new double[] { 5 });
            


            //ChartDataLabelCollection dataLabelCollection = series0.DataLabels;
            //chartDataLabel00 = dataLabelCollection.Add(0);
            //ChartDataLabel chartDataLabel01 = dataLabelCollection.Add(1);
            //chartDataLabel00.ShowLegendKey = true;
            
            //chartDataLabel00.ShowLeaderLines = true;
            //chartDataLabel00.ShowCategoryName = false;
            //chartDataLabel00.ShowPercentage = false;
            //chartDataLabel00.ShowSeriesName = true;
            //chartDataLabel00.ShowValue = true;
            //chartDataLabel00.Separator = “/“;
            //chartDataLabel01.ShowValue = true;

            doc.Save(“E:\\项目\\四川公安\\网页\\WebWord\\

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1086  2016-04-08 16:14  WebApplication3.csproj.user

     文件        998  2016-04-08 17:50  WebApplication3.sln

     文件        510  2016-04-08 15:42  WebForm1.aspx

     文件       4835  2016-04-11 11:40  WebForm1.aspx.cs

     文件       1151  2016-04-08 15:25  WebForm1.aspx.designer.cs

     文件      34713  2016-04-11 14:23  测试标题1.docx

     文件         63  2016-04-08 15:59  说明.txt

     文件    8874496  2013-05-02 23:13  bin\14\Aspose.Words13.0.dll

     文件    8744448  2015-11-05 17:44  bin\14\Aspose.Words14.dll

     文件   11217920  2016-04-08 16:33  bin\15\Aspose.Words.dll

     文件   11217920  2016-04-08 16:33  bin\Aspose.Words.dll

     文件       7680  2016-04-11 11:41  bin\WebApplication3.dll

     文件        340  2016-04-08 14:57  bin\WebApplication3.dll.config

     文件      13824  2016-04-11 11:41  bin\WebApplication3.pdb

     文件    7792128  2013-03-09 06:58  bin\新版\Aspose.Words.dll

     文件     512576  2013-03-09 06:58  bin\新版\Aspose.Words.tlb

     文件    2977280  2009-07-04 09:41  bin\旧版\Aspose.Words.dll

     文件       7935  2016-04-11 17:46  obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2016-04-08 14:57  obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2016-04-08 14:57  obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2016-04-08 14:57  obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1088  2016-04-11 09:49  obj\Debug\WebApplication3.csproj.FileListAbsolute.txt

     文件      18150  2016-04-08 16:34  obj\Debug\WebApplication3.csprojResolveAssemblyReference.cache

     文件       7680  2016-04-11 11:41  obj\Debug\WebApplication3.dll

     文件      13824  2016-04-11 11:41  obj\Debug\WebApplication3.pdb

     文件       1323  2016-04-08 14:57  Properties\AssemblyInfo.cs

     文件      12835  2016-04-11 14:23  1.001.png

     文件      11190  2016-04-11 14:23  1.002.png

     文件       1493  2016-04-11 14:23  1.html

     文件      27648  2016-04-08 16:45  test.doc

............此处省略17个文件信息

评论

共有 条评论