Aspose Example

官方使用说明(net)

http://www.aspose.com/docs/display/wordsnet/Find+and+Replace+Overview#FindandReplaceOverview-replace1

 

Aspose  dmeo

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using Aspose.Words;

 

namespace AsposeDemo

{

    class Program

    {

        static void Main(string[] args)

        {

            string tempPath = "temp.docx";

            string outPath = "new.docx";

            var doc = new Document(tempPath);

            //数据绑定到表格

            string[] fieldName = new string[] {"UserName","Gender","Birthday","Address" };

            object[] filedValues = new Object[] { "张三","男","1988-09-02","陕西咸阳"};

            doc.MailMerge.Execute(fieldName,filedValues);

            //替换书签内容

            var bookmark1 = doc.Range.Bookmarks["bookmark1"];

            bookmark1.Text = "test  bookmark";

            //查找替换

            doc.Range.Replace("myname","刘尚鑫",false,true);

            doc.Save(outPath);

            Console.WriteLine("OK");

            Console.ReadKey();

        }

    }

}

Aspose Example,布布扣,bubuko.com

Aspose Example

上一篇:从零开始学习ASP.NET MVC 1.0


下一篇:css字体样式(Font Style),属性