问题描述
我有一个用于word文件的模板,并尝试更改我编写的标签,但没有任何反应 注意:我要更改的文字是“艺术字” 我正在使用Microsoft.Office.Interop.Word库 这是我的代码:
Word.Application wordApp = new Word.Application();
object missing = Missing.Value;
Word.Document myWordDoc = null;
if (File.Exists((string)filename))
{
object readOnly = false;
object isVisible = false;
wordApp.Visible = false;
myWordDoc = wordApp.Documents.Open(ref filename,ref missing,ref readOnly,ref missing);
myWordDoc.Activate();
var range = myWordDoc.Range();
range.Find.Execute(
FindText: "<name>",Replace: WdReplace.wdReplaceAll,ReplaceWith: "",Format: true,Forward: true
);
range.Find.Execute(
FindText: "<name>",Forward: false
);
}
else
{
MessageBox.Show("File not Found!");
}
//Save as
myWordDoc.SaveAs2(ref SaveAs,ref missing);
myWordDoc.Close();
wordApp.Quit();
MessageBox.Show("File Created!");
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)