Aspose.words 替换字符 操作

var path = Server.MapPath("~/doc/demo.doc");
Document doc = new Document(path);
DocumentBuilder builder = new DocumentBuilder(doc);
//builder.Write("张三");
// var repStr = string.Format("&{0}&", "[客户姓名]");
doc.Range.Replace("[客户姓名]", "张三", false, true);
doc.Range.Replace("[姓名]", "李四", false, true);
doc.Range.Replace("[性别]", "男", false, true);
doc.Range.Replace("[年龄]", "18", false, true);

doc.Save(path);

原文地址:https://www.cnblogs.com/90nice/p/4644326.html