C# 单词全部替换
本文关键字:替换 全部 单词 | 更新日期: 2023-09-27 18:19:31
var WordApp = new Word.Application();
var WordDocument = WordApp.Documents.Open(@"C:''contract.docx");
WordReplace("{seller_name}",
dataGridView1.CurrentCell.OwningRow.Cells[1].Value.ToString(), WordDocument);
我正在使用此代码在word文档中替换。我怎样才能更换不是 1 次而是多次?我需要替换单词中的所有{seller_name}。
您可以使用
https://freeword.codeplex.com 来执行此操作。
Document doc = new Document();
doc.LoadFromFile(@"C:''contract.docx");
doc.Replace("{seller_name}", "Replace Value");