日期:2014-05-20  浏览次数:20797 次

C#对word操作中文本替换问题
Word.Document   wDoc   =   null;
Word.Application   wApp   =   null;
SysFun.CreateWordDocument(   filePath   +   @ "\Bumph\Lawless.etog ",   ref   wDoc,   ref   wApp);

                        if   (wDoc.Content.Text.IndexOf( "测试 ")   >   0)
                        {
                                MessageBox.Show( "找出来了!! ");
                        }
可以找word文档里面的文本,但不懂如何替换,
用一个str替换掉 '测试 '


------解决方案--------------------
if (wDoc.Content.Text.IndexOf( "测试 ") > 0)
{wDoc.Content.Text.Replace( "测试 ",str);

}