word替换文字加着重号 word替换文字

Spire.Doc提供了几种Replace重载方法支持在不同的场景下替换Word文档中的文本 。本篇文章将介绍如何使用另一个文档替换Word模板中的指定文本 。
Word模板:

word替换文字加着重号 word替换文字


用于替换文本的文档:
word替换文字加着重号 word替换文字


代码:
//加载Word模板
Document document = new Document(\”Template.docx\”);
//加载用于替换文本的文档
IDocument replaceDocument = new Document(\”文档 1.docx\”);
//使用该文档替换模板中的指定文本
document.Replace(\”文档 1\”, replaceDocument, false, true);
//保存文档
document.SaveToFile(\”Output.docx\”, FileFormat.Docx2013);
【word替换文字加着重号 word替换文字】效果图:
word替换文字加着重号 word替换文字


点击“了解更多”下载产品最新版
↓↓↓

    推荐阅读